Merge topic 'aliased-target-properties'

ea647533 Do not report ALIASED_TARGET as always set (#15783)
This commit is contained in:
Brad King 2016-08-01 14:59:41 -04:00 committed by CMake Topic Stage
commit 8427b8e11c
2 changed files with 7 additions and 8 deletions

View File

@ -253,7 +253,7 @@ bool cmGetPropertyCommand::HandleTargetMode()
if (this->Makefile->IsAlias(this->Name)) {
return this->StoreResult(target->GetName().c_str());
} else {
return this->StoreResult((this->Variable + "-NOTFOUND").c_str());
return this->StoreResult(NULL);
}
}
return this->StoreResult(

View File

@ -66,6 +66,11 @@ endif()
add_library(iface INTERFACE)
add_library(Alias::Iface ALIAS iface)
get_property(_aliased_target_set TARGET foo PROPERTY ALIASED_TARGET SET)
if(_aliased_target_set)
message(SEND_ERROR "ALIASED_TARGET is set for target foo")
endif()
get_target_property(_notAlias1 foo ALIASED_TARGET)
if (NOT DEFINED _notAlias1)
message(SEND_ERROR "_notAlias1 is not defined")
@ -78,12 +83,6 @@ if (NOT _notAlias1 STREQUAL _notAlias1-NOTFOUND)
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")
message(SEND_ERROR "_notAlias2 evaluates to true, but foo is not an ALIAS")
endif()