Tests/RunCMake/BuildDepends: Enable more depfile cases with Ninja

This commit is contained in:
Brad King
2024-09-12 12:24:48 -04:00
parent b751a857cc
commit 48ced5fb12
3 changed files with 29 additions and 3 deletions
@@ -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()
")
@@ -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()
")
@@ -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()