diff options
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( |