diff options
author | Brad King <brad.king@kitware.com> | 2022-01-19 14:02:44 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2022-01-19 14:02:57 (GMT) |
commit | 6b44cd7d3a8049809e63385e272d995420064801 (patch) | |
tree | f228d7718b6ca526b9e74bc3525fc9ef3d711028 /Tests | |
parent | 58804d1e58ff3aa6f3b473f8b4739ac7dc547e6a (diff) | |
parent | 0b65a2b2531b05abe1bc1f1950bb963af7a6d42f (diff) | |
download | CMake-6b44cd7d3a8049809e63385e272d995420064801.zip CMake-6b44cd7d3a8049809e63385e272d995420064801.tar.gz CMake-6b44cd7d3a8049809e63385e272d995420064801.tar.bz2 |
Merge topic 'depfile-parsing-update'
0b65a2b253 add_custom_command(DEPFILE): ensure all dependencies are taken into account
e04a352cca Depfile parsing: enhance compatibility with GNU Make
Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !6861
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") |