diff options
author | Brad King <brad.king@kitware.com> | 2020-05-21 15:52:04 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2020-05-21 15:52:12 (GMT) |
commit | 9ec09f22ff1b1109d9bb7b4e8d1aec5663029cd3 (patch) | |
tree | daea1233f4d577e5a0287417c1127a88f9be3875 /Source | |
parent | 3c5d52579b271e99475873cec953a1ecccbea585 (diff) | |
parent | f6cb1e646ca108125c33419e0829c152effaee47 (diff) | |
download | CMake-9ec09f22ff1b1109d9bb7b4e8d1aec5663029cd3.zip CMake-9ec09f22ff1b1109d9bb7b4e8d1aec5663029cd3.tar.gz CMake-9ec09f22ff1b1109d9bb7b4e8d1aec5663029cd3.tar.bz2 |
Merge topic 'multi-ninja-pch-msvc'
f6cb1e646c Multi-Ninja: Fix PCHs for Visual C++
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4771
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmGeneratorTarget.cxx | 4 | ||||
-rw-r--r-- | Source/cmLocalGenerator.cxx | 4 | ||||
-rw-r--r-- | Source/cmMakefileTargetGenerator.cxx | 11 | ||||
-rw-r--r-- | Source/cmNinjaTargetGenerator.cxx | 21 |
4 files changed, 28 insertions, 12 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 2f9da1c..917985a 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -3864,6 +3864,10 @@ std::string cmGeneratorTarget::GetPchFileObject(const std::string& config, pchSource, false, cmSourceFileLocationKind::Known); filename = cmStrCat(this->ObjectDirectory, this->GetObjectName(pchSf)); + if (this->GetGlobalGenerator()->IsMultiConfig()) { + cmSystemTools::ReplaceString( + filename, this->GetGlobalGenerator()->GetCMakeCFGIntDir(), config); + } } return inserted.first->second; } diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index f29c682..ad1cbd8 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -2633,7 +2633,9 @@ void cmLocalGenerator::AddPchDependencies(cmGeneratorTarget* target) // Exclude the pch files from linking if (this->Makefile->IsOn("CMAKE_LINK_PCH")) { if (!ReuseFrom) { - pch_sf->SetProperty("OBJECT_OUTPUTS", pchFile.c_str()); + pch_sf->AppendProperty( + "OBJECT_OUTPUTS", + cmStrCat("$<$<CONFIG:", config, ">:", pchFile, ">")); } else { auto reuseTarget = this->GlobalGenerator->FindGeneratorTarget(*ReuseFrom); diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 5f0cfcf..04d4db7 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -895,9 +895,14 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles( // Check for extra outputs created by the compilation. std::vector<std::string> outputs(1, relativeObj); if (cmProp extra_outputs_str = source.GetProperty("OBJECT_OUTPUTS")) { - // Register these as extra files to clean. - cmExpandList(*extra_outputs_str, outputs); - this->CleanFiles.insert(outputs.begin() + 1, outputs.end()); + std::string evaluated_outputs = cmGeneratorExpression::Evaluate( + *extra_outputs_str, this->LocalGenerator, config); + + if (!evaluated_outputs.empty()) { + // Register these as extra files to clean. + cmExpandList(evaluated_outputs, outputs); + this->CleanFiles.insert(outputs.begin() + 1, outputs.end()); + } } // Write the rule. diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index efd2fd5..f4ff51b 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -1266,14 +1266,19 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement( } if (cmProp objectOutputs = source->GetProperty("OBJECT_OUTPUTS")) { - cmNinjaBuild build("phony"); - build.Comment = "Additional output files."; - build.Outputs = cmExpandedList(*objectOutputs); - std::transform(build.Outputs.begin(), build.Outputs.end(), - build.Outputs.begin(), MapToNinjaPath()); - build.ExplicitDeps = objBuild.Outputs; - this->GetGlobalGenerator()->WriteBuild(this->GetImplFileStream(fileConfig), - build); + std::string evaluatedObjectOutputs = cmGeneratorExpression::Evaluate( + *objectOutputs, this->LocalGenerator, config); + + if (!evaluatedObjectOutputs.empty()) { + cmNinjaBuild build("phony"); + build.Comment = "Additional output files."; + build.Outputs = cmExpandedList(evaluatedObjectOutputs); + std::transform(build.Outputs.begin(), build.Outputs.end(), + build.Outputs.begin(), MapToNinjaPath()); + build.ExplicitDeps = objBuild.Outputs; + this->GetGlobalGenerator()->WriteBuild( + this->GetImplFileStream(fileConfig), build); + } } } |