From 70c85c1d6f7499acfc837897b54e81f89ca9ec70 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 15 May 2020 09:23:52 -0400 Subject: 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 --- Tests/ConfigSources/CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Tests/ConfigSources/CMakeLists.txt b/Tests/ConfigSources/CMakeLists.txt index c5f9c50..6e69e8b 100644 --- a/Tests/ConfigSources/CMakeLists.txt +++ b/Tests/ConfigSources/CMakeLists.txt @@ -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_$.cpp" + CONTENT "void config_$() {}\n" + ) + # Per-config sources via INTERFACE_SOURCES. add_library(iface INTERFACE) target_sources(iface INTERFACE @@ -21,6 +27,7 @@ add_executable(ConfigSources $<$:main_debug.cpp> $<$>:main_other.cpp> $<$:does_not_exist.cpp> + ${CMAKE_CURRENT_BINARY_DIR}/config_$.cpp ) target_link_libraries(ConfigSources iface) -- cgit v0.12