diff options
author | Stephen Kelly <steveire@gmail.com> | 2013-12-26 11:45:44 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2014-01-04 10:28:57 (GMT) |
commit | cd3d0b613e887eb64a7e5cb043f047ba02bdc58a (patch) | |
tree | a3d7a2d4ae794b19c2c2662f2e9cfe2820bdd6f0 | |
parent | 6a622285a7c59a938921449d1ea00e28c8d906ac (diff) | |
download | CMake-cd3d0b613e887eb64a7e5cb043f047ba02bdc58a.zip CMake-cd3d0b613e887eb64a7e5cb043f047ba02bdc58a.tar.gz CMake-cd3d0b613e887eb64a7e5cb043f047ba02bdc58a.tar.bz2 |
get_property: Fix testing ALIASED_TARGET target property (#14670)
In the case where the argument is not an ALIAS, the variable should
be set to a -NOTFOUND content.
-rw-r--r-- | Source/cmGetPropertyCommand.cxx | 2 | ||||
-rw-r--r-- | Tests/AliasTarget/CMakeLists.txt | 22 |
2 files changed, 23 insertions, 1 deletions
diff --git a/Source/cmGetPropertyCommand.cxx b/Source/cmGetPropertyCommand.cxx index faba7cd..a1454a3 100644 --- a/Source/cmGetPropertyCommand.cxx +++ b/Source/cmGetPropertyCommand.cxx @@ -298,7 +298,7 @@ bool cmGetPropertyCommand::HandleTargetMode() return this->StoreResult(target->GetName()); } } - return false; + return this->StoreResult((this->Variable + "-NOTFOUND").c_str()); } if(cmTarget* target = this->Makefile->FindTargetToUse(this->Name.c_str())) { diff --git a/Tests/AliasTarget/CMakeLists.txt b/Tests/AliasTarget/CMakeLists.txt index fdb1638..9467fae 100644 --- a/Tests/AliasTarget/CMakeLists.txt +++ b/Tests/AliasTarget/CMakeLists.txt @@ -48,3 +48,25 @@ endif() add_library(iface INTERFACE) add_library(Alias::Iface ALIAS iface) + +get_target_property(_notAlias1 foo ALIASED_TARGET) +if (NOT DEFINED _notAlias1) + message(SEND_ERROR "_notAlias1 is not defined") +endif() +if (_notAlias1) + message(SEND_ERROR "_notAlias1 is defined, but foo is not an ALIAS") +endif() +if (NOT _notAlias1 STREQUAL _notAlias1-NOTFOUND) + message(SEND_ERROR "_notAlias1 not defined to a -NOTFOUND variant") +endif() + +get_property(_notAlias2 TARGET foo PROPERTY ALIASED_TARGET) +if (NOT DEFINED _notAlias2) + message(SEND_ERROR "_notAlias2 is not defined") +endif() +if (_notAlias2) + message(SEND_ERROR "_notAlias2 is defined, but foo is not an ALIAS") +endif() +if (NOT _notAlias2 STREQUAL _notAlias2-NOTFOUND) + message(SEND_ERROR "_notAlias2 not defined to a -NOTFOUND variant") +endif() |