diff options
author | Marc Chevrier <marc.chevrier@gmail.com> | 2022-01-13 13:51:46 (GMT) |
---|---|---|
committer | Marc Chevrier <marc.chevrier@gmail.com> | 2022-01-16 13:05:59 (GMT) |
commit | e04a352cca523eba2ac0d60063a3799f5bb1c69e (patch) | |
tree | 5709a77f14fb34f5fc6d9accfd1774ca4f0dccae /Tests | |
parent | 856fbe62f33d3ad54b77635913fdfb22c853980c (diff) | |
download | CMake-e04a352cca523eba2ac0d60063a3799f5bb1c69e.zip CMake-e04a352cca523eba2ac0d60063a3799f5bb1c69e.tar.gz CMake-e04a352cca523eba2ac0d60063a3799f5bb1c69e.tar.bz2 |
Depfile parsing: enhance compatibility with GNU Make
Diffstat (limited to 'Tests')
4 files changed, 19 insertions, 0 deletions
diff --git a/Tests/RunCMake/BuildDepends/CustomCommandDepfile.cmake b/Tests/RunCMake/BuildDepends/CustomCommandDepfile.cmake index e4fdb4a..19c09c8 100644 --- a/Tests/RunCMake/BuildDepends/CustomCommandDepfile.cmake +++ b/Tests/RunCMake/BuildDepends/CustomCommandDepfile.cmake @@ -24,6 +24,13 @@ add_library(toplib STATIC toplib.c) add_subdirectory(DepfileSubdir) +add_custom_command( + OUTPUT toplib2.c + DEPFILE toplib2.c.d + COMMAND ${CMAKE_COMMAND} -DOUTFILE=toplib2.c -DINFILE=toplibdep2.txt -DDEPFILE=toplib2.c.d -P "${CMAKE_CURRENT_LIST_DIR}/WriteDepfile2.cmake" + ) +add_library(toplib2 STATIC toplib2.c) + file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/check-$<LOWER_CASE:$<CONFIG>>.cmake CONTENT " function(check_exists file) if(NOT EXISTS \"\${file}\") @@ -43,6 +50,7 @@ set(check_pairs \"${CMAKE_BINARY_DIR}/topcc.c|${CMAKE_BINARY_DIR}/topccdep.txt\" \"$<TARGET_FILE:topexe>|${CMAKE_BINARY_DIR}/topexedep.txt\" \"$<TARGET_FILE:toplib>|${CMAKE_BINARY_DIR}/toplibdep.txt\" + \"$<TARGET_FILE:toplib2>|${CMAKE_BINARY_DIR}/toplibdep2.txt\" \"${CMAKE_BINARY_DIR}/DepfileSubdir/subcc.c|${CMAKE_BINARY_DIR}/DepfileSubdir/subccdep.txt\" \"$<TARGET_FILE:subexe>|${CMAKE_BINARY_DIR}/DepfileSubdir/subexedep.txt\" \"$<TARGET_FILE:sublib>|${CMAKE_BINARY_DIR}/DepfileSubdir/sublibdep.txt\" @@ -53,6 +61,7 @@ if(check_step EQUAL 3) \"${CMAKE_BINARY_DIR}/step3.timestamp|${CMAKE_BINARY_DIR}/topcc.c\" \"${CMAKE_BINARY_DIR}/step3.timestamp|$<TARGET_FILE:topexe>\" \"${CMAKE_BINARY_DIR}/step3.timestamp|$<TARGET_FILE:toplib>\" + \"${CMAKE_BINARY_DIR}/step3.timestamp|$<TARGET_FILE:toplib2>\" \"${CMAKE_BINARY_DIR}/step3.timestamp|${CMAKE_BINARY_DIR}/DepfileSubdir/subcc.c\" \"${CMAKE_BINARY_DIR}/step3.timestamp|$<TARGET_FILE:subexe>\" \"${CMAKE_BINARY_DIR}/step3.timestamp|$<TARGET_FILE:sublib>\" diff --git a/Tests/RunCMake/BuildDepends/CustomCommandDepfile.step1.cmake b/Tests/RunCMake/BuildDepends/CustomCommandDepfile.step1.cmake index 0dfe78e..a33a03c 100644 --- a/Tests/RunCMake/BuildDepends/CustomCommandDepfile.step1.cmake +++ b/Tests/RunCMake/BuildDepends/CustomCommandDepfile.step1.cmake @@ -5,6 +5,7 @@ file(REMOVE "${RunCMake_TEST_BINARY_DIR}/step3.timestamp") file(TOUCH "${RunCMake_TEST_BINARY_DIR}/topccdep.txt") file(TOUCH "${RunCMake_TEST_BINARY_DIR}/topexedep.txt") file(TOUCH "${RunCMake_TEST_BINARY_DIR}/toplibdep.txt") +file(TOUCH "${RunCMake_TEST_BINARY_DIR}/toplibdep2.txt") file(TOUCH "${RunCMake_TEST_BINARY_DIR}/DepfileSubdir/subccdep.txt") file(TOUCH "${RunCMake_TEST_BINARY_DIR}/DepfileSubdir/subexedep.txt") file(TOUCH "${RunCMake_TEST_BINARY_DIR}/DepfileSubdir/sublibdep.txt") diff --git a/Tests/RunCMake/BuildDepends/CustomCommandDepfile.step2.cmake b/Tests/RunCMake/BuildDepends/CustomCommandDepfile.step2.cmake index c711514..ee7df7b 100644 --- a/Tests/RunCMake/BuildDepends/CustomCommandDepfile.step2.cmake +++ b/Tests/RunCMake/BuildDepends/CustomCommandDepfile.step2.cmake @@ -1,6 +1,7 @@ file(TOUCH "${RunCMake_TEST_BINARY_DIR}/topccdep.txt") file(TOUCH "${RunCMake_TEST_BINARY_DIR}/topexedep.txt") file(TOUCH "${RunCMake_TEST_BINARY_DIR}/toplibdep.txt") +file(TOUCH "${RunCMake_TEST_BINARY_DIR}/toplibdep2.txt") file(TOUCH "${RunCMake_TEST_BINARY_DIR}/DepfileSubdir/subccdep.txt") file(TOUCH "${RunCMake_TEST_BINARY_DIR}/DepfileSubdir/subexedep.txt") file(TOUCH "${RunCMake_TEST_BINARY_DIR}/DepfileSubdir/sublibdep.txt") diff --git a/Tests/RunCMake/BuildDepends/WriteDepfile2.cmake b/Tests/RunCMake/BuildDepends/WriteDepfile2.cmake new file mode 100644 index 0000000..f7898f6 --- /dev/null +++ b/Tests/RunCMake/BuildDepends/WriteDepfile2.cmake @@ -0,0 +1,8 @@ +file(WRITE "${OUTFILE}" [[int main(void) +{ + return 0; +} +]]) +string(REPLACE [[ ]] [[\ ]] OUTFILE "${OUTFILE}") +string(REPLACE [[ ]] [[\ ]] INFILE "${INFILE}") +file(WRITE "${DEPFILE}" "${OUTFILE}:\n${OUTFILE}: ${INFILE}\n") |