summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2024-09-12 13:50:38 (GMT)
committerBrad King <brad.king@kitware.com>2024-09-12 16:24:48 (GMT)
commit48ced5fb12407c7f8c4614c872caa8ed9f0a60ad (patch)
treebfe8add3a37ed90a6ca20feaf692918ba5eafbd2
parentb751a857cc2f8cc3a5e4c511193a1e19cc8c8116 (diff)
downloadCMake-48ced5fb12407c7f8c4614c872caa8ed9f0a60ad.zip
CMake-48ced5fb12407c7f8c4614c872caa8ed9f0a60ad.tar.gz
CMake-48ced5fb12407c7f8c4614c872caa8ed9f0a60ad.tar.bz2
Tests/RunCMake/BuildDepends: Enable more depfile cases with Ninja
-rw-r--r--Tests/RunCMake/BuildDepends/CompileDepends.cmake14
-rw-r--r--Tests/RunCMake/BuildDepends/CustomCommandDepends.cmake14
-rw-r--r--Tests/RunCMake/BuildDepends/RunCMakeTest.cmake4
3 files changed, 29 insertions, 3 deletions
diff --git a/Tests/RunCMake/BuildDepends/CompileDepends.cmake b/Tests/RunCMake/BuildDepends/CompileDepends.cmake
index 2a6e9a8..f0d661b 100644
--- a/Tests/RunCMake/BuildDepends/CompileDepends.cmake
+++ b/Tests/RunCMake/BuildDepends/CompileDepends.cmake
@@ -12,7 +12,7 @@ set(check_exes
\"$<TARGET_FILE:main>\"
)
-if (check_step EQUAL 2)
+if (RunCMake_GENERATOR MATCHES \"Make\" AND check_step EQUAL 2)
include(\"${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/Makefile.cmake\")
if (NOT CMAKE_DEPEND_INFO_FILES)
set(RunCMake_TEST_FAILED \"Variable CMAKE_DEPEND_INFO_FILES not found.\")
@@ -46,4 +46,16 @@ if (check_step EQUAL 2)
endforeach()
endif()
endif()
+
+if (RunCMake_GENERATOR STREQUAL \"Ninja\" AND check_step EQUAL 2)
+ execute_process(
+ COMMAND \${RunCMake_MAKE_PROGRAM} -t deps
+ WORKING_DIRECTORY \${RunCMake_TEST_BINARY_DIR}
+ OUTPUT_VARIABLE deps
+ )
+ if(NOT deps MATCHES \"CompileDepends.c\" OR NOT deps MATCHES \"CompileDepends.h\")
+ string(REPLACE deps \"\\n\" \"\\n \" \" \${deps}\")
+ set(RunCMake_TEST_FAILED \"Dependencies not detected correctly:\\n\${deps}\")
+ endif()
+endif()
")
diff --git a/Tests/RunCMake/BuildDepends/CustomCommandDepends.cmake b/Tests/RunCMake/BuildDepends/CustomCommandDepends.cmake
index 28bbf11..50ff882 100644
--- a/Tests/RunCMake/BuildDepends/CustomCommandDepends.cmake
+++ b/Tests/RunCMake/BuildDepends/CustomCommandDepends.cmake
@@ -20,7 +20,7 @@ set(check_exes
\"$<TARGET_FILE:main>\"
)
-if (check_step EQUAL 2)
+if (RunCMake_GENERATOR MATCHES \"Make\" AND check_step EQUAL 2)
include(\"${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/Makefile.cmake\")
if (NOT CMAKE_DEPEND_INFO_FILES)
set(RunCMake_TEST_FAILED \"Variable CMAKE_DEPEND_INFO_FILES not found.\")
@@ -70,4 +70,16 @@ if (check_step EQUAL 2)
endforeach()
endif()
endif()
+
+if (RunCMake_GENERATOR STREQUAL \"Ninja\" AND check_step EQUAL 2)
+ execute_process(
+ COMMAND \${RunCMake_MAKE_PROGRAM} -t deps
+ WORKING_DIRECTORY \${RunCMake_TEST_BINARY_DIR}
+ OUTPUT_VARIABLE deps
+ )
+ if(NOT deps MATCHES \"main.c:.*main.c.in\")
+ string(REPLACE deps \"\\n\" \"\\n \" \" \${deps}\")
+ set(RunCMake_TEST_FAILED \"Dependencies not detected correctly:\\n\${deps}\")
+ endif()
+endif()
")
diff --git a/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake b/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake
index bc9d57f..addb2d5 100644
--- a/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake
+++ b/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake
@@ -170,7 +170,9 @@ if ((RunCMake_GENERATOR STREQUAL "Unix Makefiles"
OR CMAKE_C_COMPILER_ID STREQUAL "AppleClang"))
OR (RunCMake_GENERATOR STREQUAL "NMake Makefiles"
AND MSVC_VERSION GREATER 1300
- AND CMAKE_C_COMPILER_ID STREQUAL "MSVC"))
+ AND CMAKE_C_COMPILER_ID STREQUAL "MSVC")
+ OR RunCMake_GENERATOR MATCHES "Ninja"
+ )
run_BuildDepends(CompileDepends)
run_BuildDepends(CustomCommandDepends)
endif()