diff options
author | Marc Chevrier <marc.chevrier@gmail.com> | 2020-05-28 13:51:22 +0200 |
---|---|---|
committer | Marc Chevrier <marc.chevrier@gmail.com> | 2020-06-02 17:11:47 +0200 |
commit | 056489d567b657bd1ebeae8bf78f4937f900b2e0 (patch) | |
tree | d3800c8fdf726c1e04cf73e463b68861efe6abd3 /Source/cmLocalGenerator.cxx | |
parent | 254f2b9058f814e952ef0178e13b3f98e8d216a1 (diff) | |
download | cmake-056489d567b657bd1ebeae8bf78f4937f900b2e0.tar.gz |
add_library/add_executable: allow local alias to imported targets
Fixes: #20641
Diffstat (limited to 'Source/cmLocalGenerator.cxx')
-rw-r--r-- | Source/cmLocalGenerator.cxx | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 3fca2d4547..f299202999 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -2049,6 +2049,15 @@ cmGeneratorTarget* cmLocalGenerator::FindGeneratorTargetToUse( return imported->second; } + // find local alias to imported target + auto aliased = this->AliasTargets.find(name); + if (aliased != this->AliasTargets.end()) { + imported = this->ImportedGeneratorTargets.find(aliased->second); + if (imported != this->ImportedGeneratorTargets.end()) { + return imported->second; + } + } + if (cmGeneratorTarget* t = this->FindLocalNonAliasGeneratorTarget(name)) { return t; } @@ -2468,7 +2477,8 @@ bool cmLocalGenerator::GetShouldUseOldFlags(bool shared, std::ostringstream e; e << "Variable " << flagsVar << " has been modified. CMake " - "will ignore the POSITION_INDEPENDENT_CODE target property for " + "will ignore the POSITION_INDEPENDENT_CODE target property " + "for " "shared libraries and will use the " << flagsVar << " variable " @@ -2565,7 +2575,8 @@ void cmLocalGenerator::AddPchDependencies(cmGeneratorTarget* target) } for (std::string const& config : configsList) { - // FIXME: Refactor collection of sources to not evaluate object libraries. + // FIXME: Refactor collection of sources to not evaluate object + // libraries. std::vector<cmSourceFile*> sources; target->GetSourceFiles(sources, config); @@ -3270,8 +3281,8 @@ const char* cmLocalGenerator::GetFeature(const std::string& feature, const std::string& config) { std::string featureName = feature; - // TODO: Define accumulation policy for features (prepend, append, replace). - // Currently we always replace. + // TODO: Define accumulation policy for features (prepend, append, + // replace). Currently we always replace. if (!config.empty()) { featureName += "_"; featureName += cmSystemTools::UpperCase(config); @@ -4120,9 +4131,9 @@ void AddUtilityCommand(cmLocalGenerator& lg, const cmListFileBacktrace& lfbt, cmImplicitDependsList no_implicit_depends; cmSourceFile* rule = AddCustomCommand( lg, lfbt, { force.Name }, byproducts, depends, no_main_dependency, - no_implicit_depends, commandLines, comment, workingDir, /*replace=*/false, - escapeOldStyle, uses_terminal, command_expand_lists, /*depfile=*/"", - job_pool, stdPipesUTF8); + no_implicit_depends, commandLines, comment, workingDir, + /*replace=*/false, escapeOldStyle, uses_terminal, command_expand_lists, + /*depfile=*/"", job_pool, stdPipesUTF8); if (rule) { lg.GetMakefile()->AddTargetByproducts(target, byproducts); } |