Tests/RunCMake/BuildDepends: Simplify CompileDepends case

Also rename from "CompilerDependencies".
This commit is contained in:
Brad King
2024-09-12 09:28:05 -04:00
parent 24fbfa915c
commit 0915320ddf
7 changed files with 19 additions and 19 deletions
@@ -0,0 +1,5 @@
#include <CompileDepends.h>
int main(void)
{
return COUNT;
}
@@ -1,11 +1,12 @@
enable_language(C) enable_language(C)
add_executable(main ${CMAKE_CURRENT_BINARY_DIR}/main.c) add_executable(main CompileDepends.c)
target_include_directories(main PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/check-$<LOWER_CASE:$<CONFIG>>.cmake CONTENT " file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/check-$<LOWER_CASE:$<CONFIG>>.cmake CONTENT "
cmake_minimum_required(VERSION ${CMAKE_VERSION})
set(check_pairs set(check_pairs
\"$<TARGET_FILE:main>|${CMAKE_CURRENT_BINARY_DIR}/main.c\" \"$<TARGET_FILE:main>|${CMAKE_CURRENT_BINARY_DIR}/CompileDepends.h\"
\"$<TARGET_FILE:main>|${CMAKE_CURRENT_BINARY_DIR}/main.h\"
) )
set(check_exes set(check_exes
\"$<TARGET_FILE:main>\" \"$<TARGET_FILE:main>\"
@@ -35,9 +36,9 @@ if (check_step EQUAL 2)
else() else()
string(REPLACE \"\\\\ \" \" \" DEPENDS_CONTENT \"\${DEPENDS_CONTENT}\") string(REPLACE \"\\\\ \" \" \" DEPENDS_CONTENT \"\${DEPENDS_CONTENT}\")
endif() endif()
if(NOT DEPENDS_CONTENT MATCHES \"\${OBJECT_FILE} *:.+main.c\" if(NOT DEPENDS_CONTENT MATCHES \"\${OBJECT_FILE} *:.+[Cc]ompile[Dd]epends.c\"
OR NOT DEPENDS_CONTENT MATCHES \"main.h\") OR NOT DEPENDS_CONTENT MATCHES \"[Cc]ompile[Dd]epends.h\")
set(RunCMake_TEST_FAILED \"Dependency file '\${TARGET_DEP_FILE}' badly generated.\") set(RunCMake_TEST_FAILED \"Dependency file badly generated:\n \${TARGET_DEP_FILE}\")
endif() endif()
endif() endif()
endif() endif()
@@ -0,0 +1,3 @@
file(WRITE "${RunCMake_TEST_BINARY_DIR}/CompileDepends.h" [[
#define COUNT 1
]])
@@ -0,0 +1,3 @@
file(WRITE "${RunCMake_TEST_BINARY_DIR}/CompileDepends.h" [[
#define COUNT 2
]])
@@ -1,9 +0,0 @@
file(WRITE "${RunCMake_TEST_BINARY_DIR}/main.h" [[
#define COUNT 1
]])
file(WRITE "${RunCMake_TEST_BINARY_DIR}/main.c" [[
#include "main.h"
int main(void) { return COUNT; }
]])
@@ -1,3 +0,0 @@
file(WRITE "${RunCMake_TEST_BINARY_DIR}/main.h" [[
#define COUNT 2
]])
@@ -171,7 +171,7 @@ if ((RunCMake_GENERATOR STREQUAL "Unix Makefiles"
OR (RunCMake_GENERATOR STREQUAL "NMake Makefiles" OR (RunCMake_GENERATOR STREQUAL "NMake Makefiles"
AND MSVC_VERSION GREATER 1300 AND MSVC_VERSION GREATER 1300
AND CMAKE_C_COMPILER_ID STREQUAL "MSVC")) AND CMAKE_C_COMPILER_ID STREQUAL "MSVC"))
run_BuildDepends(CompilerDependencies) run_BuildDepends(CompileDepends)
run_BuildDepends(CustomCommandDependencies) run_BuildDepends(CustomCommandDependencies)
endif() endif()