mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-06 05:40:54 -06:00
Merge topic 'avoid-cmake-cfg-intdir'
2b17b6da6acmGlobalGenerator: Avoid referencing CMAKE_CFG_INTDIRf34876561fTests: Remove or silence instances of ${CMAKE_CFG_INTDIR}78cf427157RULE_LAUNCH_*: Add support for generator expressionscabad8a37fExternalProject: Always use $<CONFIG> for source files62e8884d3fCTestTargets: Use $<CONFIG> instead of ${CMAKE_CFG_INTDIR} Acked-by: Kitware Robot <kwrobot@kitware.com> Tested-by: buildbot <buildbot@kitware.com> Merge-request: !8169
This commit is contained in:
@@ -41,7 +41,7 @@ set(__conf_types "")
|
||||
get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
|
||||
if(_isMultiConfig)
|
||||
# We need to pass the configuration type on the test command line.
|
||||
set(__conf_types -C "${CMAKE_CFG_INTDIR}")
|
||||
set(__conf_types -C "$<CONFIG>")
|
||||
endif()
|
||||
|
||||
# Add convenience targets. Do this at most once in case of nested
|
||||
|
||||
@@ -2091,13 +2091,7 @@ function(_ep_get_configuration_subdir_genex suffix_var)
|
||||
set(suffix "")
|
||||
get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
|
||||
if(_isMultiConfig)
|
||||
if(CMAKE_GENERATOR STREQUAL "Xcode")
|
||||
# The Xcode generator does not support per-config sources,
|
||||
# so use the underlying build system's placeholder instead.
|
||||
set(suffix "/${CMAKE_CFG_INTDIR}")
|
||||
else()
|
||||
set(suffix "/$<CONFIG>")
|
||||
endif()
|
||||
set(suffix "/$<CONFIG>")
|
||||
endif()
|
||||
set(${suffix_var} "${suffix}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
return this->Makefile->GetProperty(prop);
|
||||
if (value) {
|
||||
return cmGeneratorExpression::Evaluate(*value, this, config, target);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
std::string cmLocalGenerator::ConvertToIncludeReference(
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 += " ";
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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, ' ');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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 =
|
||||
|
||||
@@ -2,7 +2,7 @@ add_custom_target(mkdir COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CURR
|
||||
add_custom_command(
|
||||
OUTPUT out.txt
|
||||
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/PrintDir.cmake
|
||||
WORKING_DIRECTORY ${CMAKE_CFG_INTDIR}
|
||||
WORKING_DIRECTORY $<CONFIG>
|
||||
)
|
||||
set_property(SOURCE out.txt PROPERTY SYMBOLIC 1)
|
||||
add_custom_target(drive ALL DEPENDS out.txt)
|
||||
|
||||
@@ -11,7 +11,7 @@ string(REPLACE "${CMAKE_END_TEMP_FILE}" "" CMAKE_C_CREATE_SHARED_LIBRARY "${CMAK
|
||||
|
||||
add_library(example SHARED LinkOptionsLib.c)
|
||||
# use LAUNCH facility to dump linker command
|
||||
set_property(TARGET example PROPERTY RULE_LAUNCH_LINK "\"${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/dump${CMAKE_EXECUTABLE_SUFFIX}\"")
|
||||
set_property(TARGET example PROPERTY RULE_LAUNCH_LINK "\"$<TARGET_FILE:dump>\"")
|
||||
|
||||
add_dependencies (example dump)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user