summaryrefslogtreecommitdiffstats
path: root/Source/cmCustomCommandGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-11-05 14:09:19 (GMT)
committerKitware Robot <kwrobot@kitware.com>2021-11-05 14:09:28 (GMT)
commite479650b4104882d09646ad3e8a71299b9bd43ad (patch)
tree010ba6cc67b70bec2cee21c423f0f3878f2690be /Source/cmCustomCommandGenerator.cxx
parenta62acb59f4989663482bb4efcf52c4f7bbeec714 (diff)
parent95f44e00cd1fd90a68f466b432198ca98456cce7 (diff)
downloadCMake-e479650b4104882d09646ad3e8a71299b9bd43ad.zip
CMake-e479650b4104882d09646ad3e8a71299b9bd43ad.tar.gz
CMake-e479650b4104882d09646ad3e8a71299b9bd43ad.tar.bz2
Merge topic 'nmc-cross-config-target-deps'
95f44e00cd Ninja Multi-Config: Fix custom command target dependencies in cross-configs a883363935 Ninja Multi-Config: Fix internal cross-config target dependency ordering 16e24748c5 Ninja Multi-Config: Fix cross-config custom command dependency tracing Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Merge-request: !6702
Diffstat (limited to 'Source/cmCustomCommandGenerator.cxx')
-rw-r--r--Source/cmCustomCommandGenerator.cxx12
1 files changed, 8 insertions, 4 deletions
diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx
index 105ccf1..41d4442 100644
--- a/Source/cmCustomCommandGenerator.cxx
+++ b/Source/cmCustomCommandGenerator.cxx
@@ -91,7 +91,7 @@ std::string EvaluateSplitConfigGenex(
// Record targets referenced by the genex.
if (utils) {
- // FIXME: What is the proper condition for a cross-dependency?
+ // Use a cross-dependency if we referenced the command config.
bool const cross = !useOutputConfig;
for (cmGeneratorTarget* gt : cge->GetTargets()) {
utils->emplace(BT<std::pair<std::string, bool>>(
@@ -176,6 +176,8 @@ cmCustomCommandGenerator::cmCustomCommandGenerator(
cmGeneratorTarget const* target{ lg->FindGeneratorTargetToUse(
this->Target) };
+ bool const distinctConfigs = this->OutputConfig != this->CommandConfig;
+
const cmCustomCommandLines& cmdlines = this->CC->GetCommandLines();
for (cmCustomCommandLine const& cmdline : cmdlines) {
cmCustomCommandLine argv;
@@ -191,8 +193,10 @@ cmCustomCommandGenerator::cmCustomCommandGenerator(
argv.push_back(std::move(parsed_arg));
}
- // For remaining arguments, we default to the OUTPUT_CONFIG.
- useOutputConfig = true;
+ if (distinctConfigs) {
+ // For remaining arguments, we default to the OUTPUT_CONFIG.
+ useOutputConfig = true;
+ }
}
if (!argv.empty()) {
@@ -200,7 +204,7 @@ cmCustomCommandGenerator::cmCustomCommandGenerator(
// collect the target to add a target-level dependency on it.
cmGeneratorTarget* gt = this->LG->FindGeneratorTargetToUse(argv.front());
if (gt && gt->GetType() == cmStateEnums::EXECUTABLE) {
- // FIXME: What is the proper condition for a cross-dependency?
+ // GetArgv0Location uses the command config, so use a cross-dependency.
bool const cross = true;
this->Utilities.emplace(BT<std::pair<std::string, bool>>(
{ gt->GetName(), cross }, cc.GetBacktrace()));