diff options
author | Brad King <brad.king@kitware.com> | 2021-11-05 14:09:19 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2021-11-05 14:09:27 (GMT) |
commit | ced697d2846abea4b320647a46213c6e130c9a8b (patch) | |
tree | d0e8ad6987a2dde141b737db1ffe8d16d4d9061f /Source | |
parent | 2bd4e484865d982c76bf991021b07204c936fa26 (diff) | |
parent | 95f44e00cd1fd90a68f466b432198ca98456cce7 (diff) | |
download | CMake-ced697d2846abea4b320647a46213c6e130c9a8b.zip CMake-ced697d2846abea4b320647a46213c6e130c9a8b.tar.gz CMake-ced697d2846abea4b320647a46213c6e130c9a8b.tar.bz2 |
Merge topic 'nmc-cross-config-target-deps' into release-3.22
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')
-rw-r--r-- | Source/cmCustomCommandGenerator.cxx | 12 | ||||
-rw-r--r-- | Source/cmGlobalGenerator.cxx | 3 | ||||
-rw-r--r-- | Source/cmGlobalGenerator.h | 2 | ||||
-rw-r--r-- | Source/cmGlobalNinjaGenerator.cxx | 3 | ||||
-rw-r--r-- | Source/cmGlobalNinjaGenerator.h | 2 | ||||
-rw-r--r-- | Source/cmLinkItem.cxx | 12 |
6 files changed, 21 insertions, 13 deletions
diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx index 04d09d4..fd0a63c 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())); diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index ac283ab..9914902 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1402,6 +1402,9 @@ bool cmGlobalGenerator::Compute() this->SupportsDefaultConfigs())) { return false; } + if (!this->InspectConfigTypeVariables()) { + return false; + } // Some generators track files replaced during the Generate. // Start with an empty vector: diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index cc0ad29..96696aa 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -153,6 +153,8 @@ public: */ virtual void Configure(); + virtual bool InspectConfigTypeVariables() { return true; } + bool Compute(); virtual void AddExtraIDETargets() {} diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 3f6f55e..7122b9f 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -568,9 +568,6 @@ void cmGlobalNinjaGenerator::Generate() msg.str()); return; } - if (!this->InspectConfigTypeVariables()) { - return; - } if (!this->OpenBuildFileStreams()) { return; } diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index ec73475..84fc06c 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -481,8 +481,6 @@ protected: const std::set<std::string>& all, const std::set<std::string>& defaults, const std::vector<std::string>& items); - virtual bool InspectConfigTypeVariables() { return true; } - std::set<std::string> CrossConfigs; std::set<std::string> DefaultConfigs; std::string DefaultFileConfig; diff --git a/Source/cmLinkItem.cxx b/Source/cmLinkItem.cxx index 4e50d70..62e7ef4 100644 --- a/Source/cmLinkItem.cxx +++ b/Source/cmLinkItem.cxx @@ -32,7 +32,11 @@ bool operator<(cmLinkItem const& l, cmLinkItem const& r) { // Order among targets. if (l.Target && r.Target) { - return l.Target < r.Target; + if (l.Target != r.Target) { + return l.Target < r.Target; + } + // Order identical targets via cross-config. + return l.Cross < r.Cross; } // Order targets before strings. if (l.Target) { @@ -42,10 +46,10 @@ bool operator<(cmLinkItem const& l, cmLinkItem const& r) return false; } // Order among strings. - if (l.String < r.String) { - return true; + if (l.String != r.String) { + return l.String < r.String; } - // Order among cross-config. + // Order identical strings via cross-config. return l.Cross < r.Cross; } |