diff options
author | NAKAMURA Takumi <geek4civic@gmail.com> | 2021-07-08 14:10:06 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-07-08 16:17:37 (GMT) |
commit | 8a812dde61e0c309184100ef5d80fb2047c7d6b0 (patch) | |
tree | f3ca1e313faad85e87f75104949c8fc4be7d906f /Source/cmGlobalGenerator.cxx | |
parent | 854dcb0d01676f444d0aae9e6a095a80c5819496 (diff) | |
download | CMake-8a812dde61e0c309184100ef5d80fb2047c7d6b0.zip CMake-8a812dde61e0c309184100ef5d80fb2047c7d6b0.tar.gz CMake-8a812dde61e0c309184100ef5d80fb2047c7d6b0.tar.bz2 |
cmGlobalGenerator: Use cmMakefile::CreateNewTarget to add global targets
`cmMakefile::CreateNewTarget` updates also `cmMakefile::OrderedTargets`.
Diffstat (limited to 'Source/cmGlobalGenerator.cxx')
-rw-r--r-- | Source/cmGlobalGenerator.cxx | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index cad7855..5d3fdce 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1263,10 +1263,8 @@ void cmGlobalGenerator::Configure() this->CreateDefaultGlobalTargets(globalTargets); for (const auto& mf : this->Makefiles) { - auto& targets = mf->GetTargets(); for (GlobalTargetInfo const& globalTarget : globalTargets) { - targets.emplace(globalTarget.Name, - this->CreateGlobalTarget(globalTarget, mf.get())); + this->CreateGlobalTarget(globalTarget, mf.get()); } } } @@ -2824,12 +2822,19 @@ bool cmGlobalGenerator::UseFolderProperty() const return false; } -cmTarget cmGlobalGenerator::CreateGlobalTarget(GlobalTargetInfo const& gti, - cmMakefile* mf) +void cmGlobalGenerator::CreateGlobalTarget(GlobalTargetInfo const& gti, + cmMakefile* mf) { // Package - cmTarget target(gti.Name, cmStateEnums::GLOBAL_TARGET, - cmTarget::VisibilityNormal, mf, gti.PerConfig); + auto tb = + mf->CreateNewTarget(gti.Name, cmStateEnums::GLOBAL_TARGET, gti.PerConfig); + + // Do nothing if gti.Name is already used + if (!tb.second) { + return; + } + + cmTarget& target = tb.first; target.SetProperty("EXCLUDE_FROM_ALL", "TRUE"); std::vector<std::string> no_outputs; @@ -2853,8 +2858,6 @@ cmTarget cmGlobalGenerator::CreateGlobalTarget(GlobalTargetInfo const& gti, if (this->UseFolderProperty()) { target.SetProperty("FOLDER", this->GetPredefinedTargetsFolder()); } - - return target; } std::string cmGlobalGenerator::GenerateRuleFile( |