diff options
author | Brad King <brad.king@kitware.com> | 2022-06-08 16:37:48 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2022-06-08 19:13:27 (GMT) |
commit | c111d440cef08f744f910ebdca063f1c63586e84 (patch) | |
tree | 33e741419d362df4a73a0a4042d4eec810916889 /Tests/RunCMake/NinjaMultiConfig | |
parent | aaf5353c47965cae7e12aa03884be3ae67e9b09a (diff) | |
download | CMake-c111d440cef08f744f910ebdca063f1c63586e84.zip CMake-c111d440cef08f744f910ebdca063f1c63586e84.tar.gz CMake-c111d440cef08f744f910ebdca063f1c63586e84.tar.bz2 |
ExternalProject: Express per-config step stamp file paths using CONFIG genex
The ExternalProject module has long used the generator-specific
placeholder in the `${CMAKE_CFG_INTDIR}` variable to express per-config
stamp file paths in multi-config generators. Now that most generators
support generator expressions in custom command outputs, we can use
the `$<CONFIG>` genex instead.
In particular, this fixes cross-config `BUILD_BYPRODUCTS` with the Ninja
Multi-Config generator.
Fixes: #23595
Diffstat (limited to 'Tests/RunCMake/NinjaMultiConfig')
-rw-r--r-- | Tests/RunCMake/NinjaMultiConfig/ExternalProject.cmake | 9 | ||||
-rw-r--r-- | Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake | 7 |
2 files changed, 16 insertions, 0 deletions
diff --git a/Tests/RunCMake/NinjaMultiConfig/ExternalProject.cmake b/Tests/RunCMake/NinjaMultiConfig/ExternalProject.cmake new file mode 100644 index 0000000..7948133 --- /dev/null +++ b/Tests/RunCMake/NinjaMultiConfig/ExternalProject.cmake @@ -0,0 +1,9 @@ +include(ExternalProject) +ExternalProject_Add(proj1 + DOWNLOAD_COMMAND "" + SOURCE_DIR "" + CONFIGURE_COMMAND ${CMAKE_COMMAND} -E echo "Configure proj1" + BUILD_COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/out-$<CONFIG>.txt + BUILD_BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/out-$<CONFIG>.txt + INSTALL_COMMAND "" +) diff --git a/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake index dbc3151..738bc6c 100644 --- a/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake +++ b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake @@ -432,6 +432,13 @@ run_cmake_configure(ExcludeFromAll) include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake) run_cmake_build(ExcludeFromAll all "" all:all) +set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/ExternalProject-build) +set(RunCMake_TEST_OPTIONS "-DCMAKE_CROSS_CONFIGS=all;-DCMAKE_DEFAULT_CONFIGS=Debug\\;Release") +run_cmake_configure(ExternalProject) +unset(RunCMake_TEST_OPTIONS) +run_cmake_build(ExternalProject release-in-debug-graph "Debug" all:Release) +run_cmake_build(ExternalProject debug-in-release-graph "Release" all:Debug) + # FIXME Get this working #set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/AutoMocExecutable-build) #run_cmake_configure(AutoMocExecutable) |