Files
cmake/Tests/RunCMake/alias_targets/set_target_properties.cmake
Arha Gatram a121419908 ALIAS: Add support for set_property and set_target_properties commands
Currently, getting properties from an ALIAS target retrieves the property
from the target which the alias references while setting properties results
in an error. This relaxes set_property and set_target_properties to
accept ALIAS targets and act on the referenced target, mirroring the get
behavior.

An error is raised when setting ALIAS_GLOBAL or ALIASED_TARGET on an ALIAS
target.

Closes: #19445
2026-07-07 07:32:27 -07:00

14 lines
367 B
CMake

enable_language(CXX)
add_library(foo empty.cpp)
add_library(alias ALIAS foo)
set_target_properties(alias PROPERTIES ANYTHING 1)
get_target_property(val foo ANYTHING)
if(NOT val STREQUAL "1")
message(SEND_ERROR "set_target_properties(): Target property 'ANYTHING' set on ALIAS 'alias' has wrong value on aliased target 'foo': '${val}' instead of '1'.")
endif()