ALIAS: Add test for generator expressions with ALIAS targets

Generator expressions already correctly get properties of an ALIAS from
the referenced target. Adds a test to verify a more complicated case
that a generator expression set on an ALIAS target to a transitive
property that gets a property from the ALIAS evaluates correctly.
This commit is contained in:
Arha Gatram
2026-06-16 10:55:50 -07:00
committed by Brad King
parent 5f8cc64695
commit 17094eb572
3 changed files with 16 additions and 0 deletions

View File

@@ -14,6 +14,7 @@ run_cmake(alias-target)
run_cmake(set_property)
run_cmake(set_property-ALIAS_GLOBAL)
run_cmake(get_property)
run_cmake(generator-expression)
run_cmake(set_target_properties)
run_cmake(set_target_properties-ALIAS_GLOBAL)
run_cmake(target_link_libraries)

View File

@@ -0,0 +1,5 @@
file(READ "${RunCMake_TEST_BINARY_DIR}/generator-expression-generated.txt" content)
if(NOT content STREQUAL "value")
set(RunCMake_TEST_FAILED "set_property(): Target property 'COMPILE_DEFINITIONS' set on ALIAS 'alias::lib' has wrong value on aliased target 'lib': '${content}' instead of 'value'.")
endif()

View File

@@ -0,0 +1,10 @@
enable_language(CXX)
add_library(lib empty.cpp)
add_library(alias::lib ALIAS lib)
set_property(TARGET alias::lib PROPERTY COMPILE_DEFINITIONS $<TARGET_PROPERTY:alias::lib,FOO>)
set_property(TARGET lib PROPERTY FOO value)
file(GENERATE OUTPUT "generator-expression-generated.txt" CONTENT "$<TARGET_PROPERTY:lib,COMPILE_DEFINITIONS>")