summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2018-02-23 13:20:37 (GMT)
committerKitware Robot <kwrobot@kitware.com>2018-02-23 13:24:14 (GMT)
commit4732dbf32d783f2527478ec11fd603590c13e2a7 (patch)
tree032b1aee21568516e5740a902e4c48c3fbe58542 /Source
parentf6fc689c26dcc10408f3208f1399769da06ecfc2 (diff)
parent84de8b80ec1fcb32c0455359b9abb414b65ad17c (diff)
downloadCMake-4732dbf32d783f2527478ec11fd603590c13e2a7.zip
CMake-4732dbf32d783f2527478ec11fd603590c13e2a7.tar.gz
CMake-4732dbf32d783f2527478ec11fd603590c13e2a7.tar.bz2
Merge topic 'ninja-depfile-name'
84de8b80 Ninja: Use as dependency file <objectDir/SourceName>.d if needed. Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !1781
Diffstat (limited to 'Source')
-rw-r--r--Source/cmNinjaTargetGenerator.cxx22
1 files changed, 20 insertions, 2 deletions
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index f4faf47..e18959b 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -856,9 +856,27 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement(
vars["FLAGS"] = this->ComputeFlagsForObject(source, language);
vars["DEFINES"] = this->ComputeDefines(source, language);
vars["INCLUDES"] = this->ComputeIncludes(source, language);
+
if (!this->NeedDepTypeMSVC(language)) {
- vars["DEP_FILE"] = this->GetLocalGenerator()->ConvertToOutputFormat(
- objectFileName + ".d", cmOutputConverter::SHELL);
+ bool replaceExt(false);
+ if (!language.empty()) {
+ std::string repVar = "CMAKE_";
+ repVar += language;
+ repVar += "_DEPFILE_EXTENSION_REPLACE";
+ replaceExt = this->Makefile->IsOn(repVar);
+ }
+ if (!replaceExt) {
+ // use original code
+ vars["DEP_FILE"] = this->GetLocalGenerator()->ConvertToOutputFormat(
+ objectFileName + ".d", cmOutputConverter::SHELL);
+ } else {
+ // Replace the original source file extension with the
+ // depend file extension.
+ std::string dependFileName =
+ cmSystemTools::GetFilenameWithoutLastExtension(objectFileName) + ".d";
+ vars["DEP_FILE"] = this->GetLocalGenerator()->ConvertToOutputFormat(
+ objectFileDir + "/" + dependFileName, cmOutputConverter::SHELL);
+ }
}
this->ExportObjectCompileCommand(