Files
CMake/Tests/RunCMake/GeneratorExpression/CMP0199-WARN.cmake
T
Matthew Woehlke 8ac826a5f2 GenEx: Fix evaluation of $<CONFIG> on imported targets
The historic implementation of `$<CONFIG>` had some errors that could
result in multiple configurations matching. First, it always considered
the configuration of the consuming target, even if a consumed imported
target selected a different configuration. Second, it matched the entire
list of `MAP_IMPORTED_CONFIG_<CONFIG>` configurations, even if none of
those were actually selected. The latter in particular is redundant at
best, as we also consider the selected configuration of an imported
target, which is the correct configuration to match for imported
targets. Refactor the implementation so that only one configuration is
considered.

Fixes: #23660
Issue: #27022
2025-07-30 15:12:03 -04:00

12 lines
304 B
CMake

project(test-CMP0199-WARN C)
set(CMAKE_POLICY_WARNING_CMP0199 ON)
add_library(lib_test INTERFACE IMPORTED)
set_target_properties(lib_test PROPERTIES
INTERFACE_COMPILE_DEFINITIONS "$<$<CONFIG:release>:RELEASE>"
)
add_executable(exe_test configtest.c)
target_link_libraries(exe_test PRIVATE lib_test)