summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-10-30 12:26:00 (GMT)
committerKitware Robot <kwrobot@kitware.com>2023-10-30 12:26:08 (GMT)
commit6474d5d03a66ab9ee2de15039f4db96ce7b2c779 (patch)
tree4b12ff3fae76d2a9cedd05c614f95dd2365970fa /Tests
parent9e1667e62aa2a83eb8acb4f1cbb2ecb5584f62b1 (diff)
parent09c962a6a43fecd5d14d3a43654ef9bb5c48a536 (diff)
downloadCMake-6474d5d03a66ab9ee2de15039f4db96ce7b2c779.zip
CMake-6474d5d03a66ab9ee2de15039f4db96ce7b2c779.tar.gz
CMake-6474d5d03a66ab9ee2de15039f4db96ce7b2c779.tar.bz2
Merge topic 'cxxmodules-ninja-forced-rsp-files' into release-3.28
09c962a6a4 Tests/CXXModules: test forced rsp files with ninja Acked-by: Kitware Robot <kwrobot@kitware.com> Tested-by: buildbot <buildbot@kitware.com> Merge-request: !8926
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/CXXModules/NinjaForceResponseFile-check.cmake23
-rw-r--r--Tests/RunCMake/CXXModules/NinjaForceResponseFile.cmake27
-rw-r--r--Tests/RunCMake/CXXModules/RunCMakeTest.cmake1
3 files changed, 51 insertions, 0 deletions
diff --git a/Tests/RunCMake/CXXModules/NinjaForceResponseFile-check.cmake b/Tests/RunCMake/CXXModules/NinjaForceResponseFile-check.cmake
new file mode 100644
index 0000000..b8863e7
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/NinjaForceResponseFile-check.cmake
@@ -0,0 +1,23 @@
+if (RunCMake_GENERATOR_IS_MULTI_CONFIG)
+ set(path "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/impl-Debug.ninja")
+else ()
+ set(path "${RunCMake_TEST_BINARY_DIR}/build.ninja")
+endif ()
+
+if (NOT EXISTS "${path}")
+ list(APPEND RunCMake_TEST_FAILED
+ "Failed to find `ninja` build file: '${path}'")
+endif ()
+
+file(READ "${path}" rspfiles
+ REGEX "^ *RSP_FILE =")
+
+if (rspfiles MATCHES "\\$out\\.rsp$")
+ message(FATAL_ERROR
+ "rspfiles for modules should be specified explicitly")
+elseif (NOT rspfiles MATCHES "ddi\\.rsp")
+ message(FATAL_ERROR
+ "rspfiles for scanning rules should be specified according to scan output filenames")
+endif ()
+
+string(REPLACE ";" "\n " RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}")
diff --git a/Tests/RunCMake/CXXModules/NinjaForceResponseFile.cmake b/Tests/RunCMake/CXXModules/NinjaForceResponseFile.cmake
new file mode 100644
index 0000000..bac3263
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/NinjaForceResponseFile.cmake
@@ -0,0 +1,27 @@
+# Fake out that we have dyndep; we only need to generate, not actually build
+# here.
+set(CMAKE_CXX_SCANDEP_SOURCE "")
+
+enable_language(CXX)
+
+if (NOT CMAKE_GENERATOR MATCHES "Ninja")
+ message(FATAL_ERROR
+ "This test requires a 'Ninja' generator to be used.")
+endif ()
+
+set(CMAKE_NINJA_FORCE_RESPONSE_FILE 1)
+
+add_library(ninja-forced-response-file)
+target_sources(ninja-forced-response-file
+ PRIVATE
+ FILE_SET modules TYPE CXX_MODULES
+ BASE_DIRS
+ "${CMAKE_CURRENT_SOURCE_DIR}/sources"
+ FILES
+ sources/module.cxx
+ sources/module-part.cxx
+ FILE_SET internal_partitions TYPE CXX_MODULES FILES
+ sources/module-internal-part.cxx)
+target_compile_features(ninja-forced-response-file
+ PRIVATE
+ cxx_std_20)
diff --git a/Tests/RunCMake/CXXModules/RunCMakeTest.cmake b/Tests/RunCMake/CXXModules/RunCMakeTest.cmake
index e687e9f..c1c42c4 100644
--- a/Tests/RunCMake/CXXModules/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CXXModules/RunCMakeTest.cmake
@@ -94,6 +94,7 @@ if (RunCMake_GENERATOR MATCHES "Ninja")
run_cmake(NinjaDependInfoFileSet)
run_cmake(NinjaDependInfoExport)
run_cmake(NinjaDependInfoBMIInstall)
+ run_cmake(NinjaForceResponseFile) # issue#25367
elseif (RunCMake_GENERATOR MATCHES "Visual Studio")
run_cmake(VisualStudioNoSyntheticTargets)
else ()