diff options
author | Stephen Kelly <steveire@gmail.com> | 2013-07-12 07:14:31 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2013-08-02 13:21:00 (GMT) |
commit | 370bf554151a1b272baf62a0ce9823cf9995116e (patch) | |
tree | 8f0a75a9894691c2b56588c3be4b090bf07a1558 /Source/cmGetTargetPropertyCommand.cxx | |
parent | b341bf2178e3923636735ae1df53a33e5857df7d (diff) | |
download | CMake-370bf554151a1b272baf62a0ce9823cf9995116e.zip CMake-370bf554151a1b272baf62a0ce9823cf9995116e.tar.gz CMake-370bf554151a1b272baf62a0ce9823cf9995116e.tar.bz2 |
Add the ALIAS target concept for libraries and executables.
* The ALIAS name must match a validity regex.
* Executables and libraries may be aliased.
* An ALIAS acts immutable. It can not be used as the lhs
of target_link_libraries or other commands.
* An ALIAS can be used with add_custom_command, add_custom_target,
and add_test in the same way regular targets can.
* The target of an ALIAS can be retrieved with the ALIASED_TARGET
target property.
* An ALIAS does not appear in the generated buildsystem. It
is kept separate from cmMakefile::Targets for that reason.
* A target may have multiple aliases.
* An ALIAS target may not itself have an alias.
* An IMPORTED target may not have an alias.
* An ALIAS may not be exported or imported.
Diffstat (limited to 'Source/cmGetTargetPropertyCommand.cxx')
-rw-r--r-- | Source/cmGetTargetPropertyCommand.cxx | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/Source/cmGetTargetPropertyCommand.cxx b/Source/cmGetTargetPropertyCommand.cxx index 1947139..02f00a5 100644 --- a/Source/cmGetTargetPropertyCommand.cxx +++ b/Source/cmGetTargetPropertyCommand.cxx @@ -22,17 +22,30 @@ bool cmGetTargetPropertyCommand } std::string var = args[0].c_str(); const char* targetName = args[1].c_str(); + const char *prop = 0; - if(cmTarget* tgt = this->Makefile->FindTargetToUse(targetName)) + if(args[2] == "ALIASED_TARGET") { - cmTarget& target = *tgt; - const char *prop = target.GetProperty(args[2].c_str()); - if (prop) + if(this->Makefile->IsAlias(targetName)) { - this->Makefile->AddDefinition(var.c_str(), prop); - return true; + if(cmTarget* target = + this->Makefile->FindTargetToUse(targetName)) + { + prop = target->GetName(); + } } } + else if(cmTarget* tgt = this->Makefile->FindTargetToUse(targetName)) + { + cmTarget& target = *tgt; + prop = target.GetProperty(args[2].c_str()); + } + + if (prop) + { + this->Makefile->AddDefinition(var.c_str(), prop); + return true; + } this->Makefile->AddDefinition(var.c_str(), (var+"-NOTFOUND").c_str()); return true; } |