diff options
author | Brad King <brad.king@kitware.com> | 2023-02-07 14:52:23 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2023-02-07 14:52:32 (GMT) |
commit | 8c61f15cdc0cfb706391ee354482555f1bc08232 (patch) | |
tree | a57400fd3a633516d14726475534885f5bd25a82 /Source | |
parent | 9bef06d0a58d0b20c1bf11e005a9898c05e2eb14 (diff) | |
parent | 2b17b6da6acadc6676c342924bb10e2d944bf0f3 (diff) | |
download | CMake-8c61f15cdc0cfb706391ee354482555f1bc08232.zip CMake-8c61f15cdc0cfb706391ee354482555f1bc08232.tar.gz CMake-8c61f15cdc0cfb706391ee354482555f1bc08232.tar.bz2 |
Merge topic 'avoid-cmake-cfg-intdir'
2b17b6da6a cmGlobalGenerator: Avoid referencing CMAKE_CFG_INTDIR
f34876561f Tests: Remove or silence instances of ${CMAKE_CFG_INTDIR}
78cf427157 RULE_LAUNCH_*: Add support for generator expressions
cabad8a37f ExternalProject: Always use $<CONFIG> for source files
62e8884d3f CTestTargets: Use $<CONFIG> instead of ${CMAKE_CFG_INTDIR}
Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !8169
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmGlobalGenerator.cxx | 2 | ||||
-rw-r--r-- | Source/cmLocalGenerator.cxx | 13 | ||||
-rw-r--r-- | Source/cmLocalGenerator.h | 4 | ||||
-rw-r--r-- | Source/cmLocalUnixMakefileGenerator3.cxx | 6 | ||||
-rw-r--r-- | Source/cmMakefileExecutableTargetGenerator.cxx | 14 | ||||
-rw-r--r-- | Source/cmMakefileLibraryTargetGenerator.cxx | 14 | ||||
-rw-r--r-- | Source/cmMakefileTargetGenerator.cxx | 7 | ||||
-rw-r--r-- | Source/cmNinjaNormalTargetGenerator.cxx | 12 | ||||
-rw-r--r-- | Source/cmNinjaTargetGenerator.cxx | 6 |
9 files changed, 46 insertions, 32 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 4cfec22..492f848 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -2911,7 +2911,7 @@ void cmGlobalGenerator::AddGlobalTarget_Install( singleLine.push_back(cfgArg); cfgArg = "-DEFFECTIVE_PLATFORM_NAME=$(EFFECTIVE_PLATFORM_NAME)"; } else { - cfgArg += *mf->GetDefinition("CMAKE_CFG_INTDIR"); + cfgArg += this->GetCMakeCFGIntDir(); } singleLine.push_back(cfgArg); } diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 15bcd02..c2138ee 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -827,13 +827,18 @@ cmStateSnapshot cmLocalGenerator::GetStateSnapshot() const return this->Makefile->GetStateSnapshot(); } -cmValue cmLocalGenerator::GetRuleLauncher(cmGeneratorTarget* target, - const std::string& prop) +std::string cmLocalGenerator::GetRuleLauncher(cmGeneratorTarget* target, + const std::string& prop, + const std::string& config) { + cmValue value = this->Makefile->GetProperty(prop); if (target) { - return target->GetProperty(prop); + value = target->GetProperty(prop); + } + if (value) { + return cmGeneratorExpression::Evaluate(*value, this, config, target); } - return this->Makefile->GetProperty(prop); + return ""; } std::string cmLocalGenerator::ConvertToIncludeReference( diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 20f23de..bda82bc 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -532,7 +532,9 @@ public: void CreateEvaluationFileOutputs(const std::string& config); void ProcessEvaluationFiles(std::vector<std::string>& generatedFiles); - cmValue GetRuleLauncher(cmGeneratorTarget* target, const std::string& prop); + std::string GetRuleLauncher(cmGeneratorTarget* target, + const std::string& prop, + const std::string& config); protected: // The default implementation converts to a Windows shortpath to diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 7172d34..56a41b1 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -1003,7 +1003,9 @@ void cmLocalUnixMakefileGenerator3::AppendCustomCommand( std::string launcher; // Short-circuit if there is no launcher. - cmValue val = this->GetRuleLauncher(target, "RULE_LAUNCH_CUSTOM"); + std::string val = this->GetRuleLauncher( + target, "RULE_LAUNCH_CUSTOM", + this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE")); if (cmNonempty(val)) { // Expand rule variables referenced in the given launcher command. cmRulePlaceholderExpander::RuleVariables vars; @@ -1022,7 +1024,7 @@ void cmLocalUnixMakefileGenerator3::AppendCustomCommand( } vars.Output = output.c_str(); - launcher = *val; + launcher = val; rulePlaceholderExpander->ExpandRuleVariables(this, launcher, vars); if (!launcher.empty()) { launcher += " "; diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index e53d28c..41daa5a 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -222,10 +222,11 @@ void cmMakefileExecutableTargetGenerator::WriteNvidiaDeviceExecutableRule( std::string launcher; - cmValue val = this->LocalGenerator->GetRuleLauncher(this->GeneratorTarget, - "RULE_LAUNCH_LINK"); + std::string val = this->LocalGenerator->GetRuleLauncher( + this->GeneratorTarget, "RULE_LAUNCH_LINK", + this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE")); if (cmNonempty(val)) { - launcher = cmStrCat(*val, ' '); + launcher = cmStrCat(val, ' '); } std::unique_ptr<cmRulePlaceholderExpander> rulePlaceholderExpander( @@ -587,10 +588,11 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) std::string launcher; - cmValue val = this->LocalGenerator->GetRuleLauncher(this->GeneratorTarget, - "RULE_LAUNCH_LINK"); + std::string val = this->LocalGenerator->GetRuleLauncher( + this->GeneratorTarget, "RULE_LAUNCH_LINK", + this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE")); if (cmNonempty(val)) { - launcher = cmStrCat(*val, ' '); + launcher = cmStrCat(val, ' '); } std::unique_ptr<cmRulePlaceholderExpander> rulePlaceholderExpander( diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index 9669293..cb567ff 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -362,10 +362,11 @@ void cmMakefileLibraryTargetGenerator::WriteNvidiaDeviceLibraryRules( vars.TargetCompilePDB = targetOutPathCompilePDB.c_str(); std::string launcher; - cmValue val = this->LocalGenerator->GetRuleLauncher(this->GeneratorTarget, - "RULE_LAUNCH_LINK"); + std::string val = this->LocalGenerator->GetRuleLauncher( + this->GeneratorTarget, "RULE_LAUNCH_LINK", + this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE")); if (cmNonempty(val)) { - launcher = cmStrCat(*val, ' '); + launcher = cmStrCat(val, ' '); } std::unique_ptr<cmRulePlaceholderExpander> rulePlaceholderExpander( @@ -808,10 +809,11 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( } std::string launcher; - cmValue val = this->LocalGenerator->GetRuleLauncher(this->GeneratorTarget, - "RULE_LAUNCH_LINK"); + std::string val = this->LocalGenerator->GetRuleLauncher( + this->GeneratorTarget, "RULE_LAUNCH_LINK", + this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE")); if (cmNonempty(val)) { - launcher = cmStrCat(*val, ' '); + launcher = cmStrCat(val, ' '); } std::unique_ptr<cmRulePlaceholderExpander> rulePlaceholderExpander( diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 6612595..2b817c3 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -1167,10 +1167,11 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles( std::string launcher; { - cmValue val = this->LocalGenerator->GetRuleLauncher( - this->GeneratorTarget, "RULE_LAUNCH_COMPILE"); + std::string val = this->LocalGenerator->GetRuleLauncher( + this->GeneratorTarget, "RULE_LAUNCH_COMPILE", + this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE")); if (cmNonempty(val)) { - launcher = cmStrCat(*val, ' '); + launcher = cmStrCat(val, ' '); } } diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index a1633ca..45a4dda 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -263,10 +263,10 @@ void cmNinjaNormalTargetGenerator::WriteNvidiaDeviceLinkRule( vars.LanguageCompileFlags = "$LANGUAGE_COMPILE_FLAGS"; std::string launcher; - cmValue val = this->GetLocalGenerator()->GetRuleLauncher( - this->GetGeneratorTarget(), "RULE_LAUNCH_LINK"); + std::string val = this->GetLocalGenerator()->GetRuleLauncher( + this->GetGeneratorTarget(), "RULE_LAUNCH_LINK", config); if (cmNonempty(val)) { - launcher = cmStrCat(*val, ' '); + launcher = cmStrCat(val, ' '); } std::unique_ptr<cmRulePlaceholderExpander> rulePlaceholderExpander( @@ -458,10 +458,10 @@ void cmNinjaNormalTargetGenerator::WriteLinkRule(bool useResponseFile, } std::string launcher; - cmValue val = this->GetLocalGenerator()->GetRuleLauncher( - this->GetGeneratorTarget(), "RULE_LAUNCH_LINK"); + std::string val = this->GetLocalGenerator()->GetRuleLauncher( + this->GetGeneratorTarget(), "RULE_LAUNCH_LINK", config); if (cmNonempty(val)) { - launcher = cmStrCat(*val, ' '); + launcher = cmStrCat(val, ' '); } std::unique_ptr<cmRulePlaceholderExpander> rulePlaceholderExpander( diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index b77a363..cea58b7 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -670,10 +670,10 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang, cmLocalGenerator::SHELL); std::string launcher; - cmValue val = this->GetLocalGenerator()->GetRuleLauncher( - this->GetGeneratorTarget(), "RULE_LAUNCH_COMPILE"); + std::string val = this->GetLocalGenerator()->GetRuleLauncher( + this->GetGeneratorTarget(), "RULE_LAUNCH_COMPILE", config); if (cmNonempty(val)) { - launcher = cmStrCat(*val, ' '); + launcher = cmStrCat(val, ' '); } std::string const cmakeCmd = |