summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-05-15 13:23:52 (GMT)
committerBrad King <brad.king@kitware.com>2020-05-18 19:34:18 (GMT)
commit70c85c1d6f7499acfc837897b54e81f89ca9ec70 (patch)
tree940caa1f52f3810ab54eb3650cc6df3fe2ed2358
parent3b547e2e4bc084ce26b8493ce37ef7d8806fe477 (diff)
downloadCMake-70c85c1d6f7499acfc837897b54e81f89ca9ec70.zip
CMake-70c85c1d6f7499acfc837897b54e81f89ca9ec70.tar.gz
CMake-70c85c1d6f7499acfc837897b54e81f89ca9ec70.tar.bz2
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
-rw-r--r--Tests/ConfigSources/CMakeLists.txt7
1 files changed, 7 insertions, 0 deletions
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_$<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)