summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/RunCMake')
-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 ()