diff options
author | Brad King <brad.king@kitware.com> | 2013-08-06 13:07:21 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2013-08-06 13:07:21 (GMT) |
commit | 87e0e6e497b76f4ab7292cca34bd7c006832723b (patch) | |
tree | aca65d62aec61aae5e3394808d6c0cd264f3376f /Source/cmGlobalGenerator.cxx | |
parent | 0174133dfd1f46662bb517677d3bf0a765b11e3e (diff) | |
parent | 370bf554151a1b272baf62a0ce9823cf9995116e (diff) | |
download | CMake-87e0e6e497b76f4ab7292cca34bd7c006832723b.zip CMake-87e0e6e497b76f4ab7292cca34bd7c006832723b.tar.gz CMake-87e0e6e497b76f4ab7292cca34bd7c006832723b.tar.bz2 |
Merge topic 'ALIAS-targets'
370bf55 Add the ALIAS target concept for libraries and executables.
Diffstat (limited to 'Source/cmGlobalGenerator.cxx')
-rw-r--r-- | Source/cmGlobalGenerator.cxx | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 9b6ac93..7f2b592 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1769,10 +1769,22 @@ cmLocalGenerator* cmGlobalGenerator::FindLocalGenerator(const char* start_dir) return 0; } +//---------------------------------------------------------------------------- +void cmGlobalGenerator::AddAlias(const char *name, cmTarget *tgt) +{ + this->AliasTargets[name] = tgt; +} + +//---------------------------------------------------------------------------- +bool cmGlobalGenerator::IsAlias(const char *name) +{ + return this->AliasTargets.find(name) != this->AliasTargets.end(); +} //---------------------------------------------------------------------------- cmTarget* -cmGlobalGenerator::FindTarget(const char* project, const char* name) +cmGlobalGenerator::FindTarget(const char* project, const char* name, + bool excludeAliases) { // if project specific if(project) @@ -1780,7 +1792,8 @@ cmGlobalGenerator::FindTarget(const char* project, const char* name) std::vector<cmLocalGenerator*>* gens = &this->ProjectMap[project]; for(unsigned int i = 0; i < gens->size(); ++i) { - cmTarget* ret = (*gens)[i]->GetMakefile()->FindTarget(name); + cmTarget* ret = (*gens)[i]->GetMakefile()->FindTarget(name, + excludeAliases); if(ret) { return ret; @@ -1790,6 +1803,15 @@ cmGlobalGenerator::FindTarget(const char* project, const char* name) // if all projects/directories else { + if (!excludeAliases) + { + std::map<cmStdString, cmTarget*>::iterator ai + = this->AliasTargets.find(name); + if (ai != this->AliasTargets.end()) + { + return ai->second; + } + } std::map<cmStdString,cmTarget *>::iterator i = this->TotalTargets.find ( name ); if ( i != this->TotalTargets.end() ) |