summaryrefslogtreecommitdiffstats
path: root/Source/cmNinjaTargetGenerator.cxx
diff options
context:
space:
mode:
authorClaus Klein <claus.klein@arcormail.de>2018-02-20 20:42:50 (GMT)
committerClaus Klein <claus.klein@arcormail.de>2018-02-20 20:42:50 (GMT)
commit84de8b80ec1fcb32c0455359b9abb414b65ad17c (patch)
tree102cd0039c98a8521b01297e96bb04862cd4a56b /Source/cmNinjaTargetGenerator.cxx
parentb89252689cf5d63495de4b0458aa3c239acd01d4 (diff)
downloadCMake-84de8b80ec1fcb32c0455359b9abb414b65ad17c.zip
CMake-84de8b80ec1fcb32c0455359b9abb414b65ad17c.tar.gz
CMake-84de8b80ec1fcb32c0455359b9abb414b65ad17c.tar.bz2
Ninja: Use as dependency file <objectDir/SourceName>.d if needed.
Diffstat (limited to 'Source/cmNinjaTargetGenerator.cxx')
-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(