Skip to content
Snippets Groups Projects
Commit 70c85c1d authored by Brad King's avatar Brad King
Browse files

Tests: Add case for source files named with CONFIG genex

This is now expected to work on all generators where the test runs.
Recent ancestors of this commit fix the Visual Studio generator.

Fixes: #20648
parent 3b547e2e
Branches
No related tags found
No related merge requests found
......@@ -5,6 +5,12 @@ if(NOT _isMultiConfig AND NOT CMAKE_BUILD_TYPE)
endif()
project(ConfigSources CXX)
# Source file(s) named with the configuration(s).
file(GENERATE
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/config_$<CONFIG>.cpp"
CONTENT "void config_$<CONFIG>() {}\n"
)
# Per-config sources via INTERFACE_SOURCES.
add_library(iface INTERFACE)
target_sources(iface INTERFACE
......@@ -21,6 +27,7 @@ add_executable(ConfigSources
$<$<CONFIG:Debug>:main_debug.cpp>
$<$<NOT:$<CONFIG:Debug>>:main_other.cpp>
$<$<CONFIG:NotAConfig>:does_not_exist.cpp>
${CMAKE_CURRENT_BINARY_DIR}/config_$<CONFIG>.cpp
)
target_link_libraries(ConfigSources iface)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment