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

View File

@@ -0,0 +1,5 @@
#include <CompileDepends.h>
int main(void)
{
return COUNT;
}

View File

@@ -1,11 +1,12 @@
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 "
cmake_minimum_required(VERSION ${CMAKE_VERSION})
set(check_pairs
\"$<TARGET_FILE:main>|${CMAKE_CURRENT_BINARY_DIR}/main.c\"
\"$<TARGET_FILE:main>|${CMAKE_CURRENT_BINARY_DIR}/main.h\"
\"$<TARGET_FILE:main>|${CMAKE_CURRENT_BINARY_DIR}/CompileDepends.h\"
)
set(check_exes
\"$<TARGET_FILE:main>\"
@@ -35,9 +36,9 @@ if (check_step EQUAL 2)
else()
string(REPLACE \"\\\\ \" \" \" DEPENDS_CONTENT \"\${DEPENDS_CONTENT}\")
endif()
if(NOT DEPENDS_CONTENT MATCHES \"\${OBJECT_FILE} *:.+main.c\"
OR NOT DEPENDS_CONTENT MATCHES \"main.h\")
set(RunCMake_TEST_FAILED \"Dependency file '\${TARGET_DEP_FILE}' badly generated.\")
if(NOT DEPENDS_CONTENT MATCHES \"\${OBJECT_FILE} *:.+[Cc]ompile[Dd]epends.c\"
OR NOT DEPENDS_CONTENT MATCHES \"[Cc]ompile[Dd]epends.h\")
set(RunCMake_TEST_FAILED \"Dependency file badly generated:\n \${TARGET_DEP_FILE}\")
endif()
endif()
endif()

View File

@@ -0,0 +1,3 @@
file(WRITE "${RunCMake_TEST_BINARY_DIR}/CompileDepends.h" [[
#define COUNT 1
]])

View File

@@ -0,0 +1,3 @@
file(WRITE "${RunCMake_TEST_BINARY_DIR}/CompileDepends.h" [[
#define COUNT 2
]])

View File

@@ -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; }
]])

View File

@@ -1,3 +0,0 @@
file(WRITE "${RunCMake_TEST_BINARY_DIR}/main.h" [[
#define COUNT 2
]])

View File

@@ -171,7 +171,7 @@ if ((RunCMake_GENERATOR STREQUAL "Unix Makefiles"
OR (RunCMake_GENERATOR STREQUAL "NMake Makefiles"
AND MSVC_VERSION GREATER 1300
AND CMAKE_C_COMPILER_ID STREQUAL "MSVC"))
run_BuildDepends(CompilerDependencies)
run_BuildDepends(CompileDepends)
run_BuildDepends(CustomCommandDependencies)
endif()