summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorMarc Chevrier <marc.chevrier@gmail.com>2021-01-16 16:37:23 (GMT)
committerMarc Chevrier <marc.chevrier@gmail.com>2021-01-19 12:17:14 (GMT)
commitb5c2163293c08e8e53203d86a069713e06874886 (patch)
treef3d6d249054fee14b6e0122bc021be958c59b3dd /Tests
parent5b9f7a5f285d648698068abe8eb238cd4dda7161 (diff)
downloadCMake-b5c2163293c08e8e53203d86a069713e06874886.zip
CMake-b5c2163293c08e8e53203d86a069713e06874886.tar.gz
CMake-b5c2163293c08e8e53203d86a069713e06874886.tar.bz2
Ninja: add_custom_command(DEPFILE): Ensure dependencies consistency
Fixes: #21694
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/BuildDepends/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/BuildDepends/CustomCommandDepfile.cmake2
-rw-r--r--Tests/RunCMake/BuildDepends/DepfileSubdir/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/CMakeLists.txt5
-rw-r--r--Tests/RunCMake/TransformDepfile/RunCMakeTest.cmake4
-rw-r--r--Tests/RunCMake/TransformDepfile/deps-unix.d.txt8
-rw-r--r--Tests/RunCMake/TransformDepfile/deps-unix.tlog.txt8
-rw-r--r--Tests/RunCMake/TransformDepfile/deps-windows.d.txt8
-rw-r--r--Tests/RunCMake/TransformDepfile/deps-windows.tlog.txt8
-rw-r--r--Tests/RunCMake/TransformDepfile/invalid-gcc-result.txt2
-rw-r--r--Tests/RunCMake/TransformDepfile/invalid-tlog-result.txt2
11 files changed, 27 insertions, 24 deletions
diff --git a/Tests/RunCMake/BuildDepends/CMakeLists.txt b/Tests/RunCMake/BuildDepends/CMakeLists.txt
index 74b3ff8..99f238b 100644
--- a/Tests/RunCMake/BuildDepends/CMakeLists.txt
+++ b/Tests/RunCMake/BuildDepends/CMakeLists.txt
@@ -1,3 +1,3 @@
cmake_minimum_required(VERSION 3.3)
project(${RunCMake_TEST} NONE)
-include(${RunCMake_TEST}.cmake)
+include(${RunCMake_TEST}.cmake NO_POLICY_SCOPE)
diff --git a/Tests/RunCMake/BuildDepends/CustomCommandDepfile.cmake b/Tests/RunCMake/BuildDepends/CustomCommandDepfile.cmake
index 6ac1291..01eac91 100644
--- a/Tests/RunCMake/BuildDepends/CustomCommandDepfile.cmake
+++ b/Tests/RunCMake/BuildDepends/CustomCommandDepfile.cmake
@@ -4,7 +4,7 @@ enable_language(C)
add_custom_command(
OUTPUT topcc.c
DEPFILE topcc.c.d
- COMMAND ${CMAKE_COMMAND} -DOUTFILE=topcc.c -DINFILE=topccdep.txt -DDEPFILE=topcc.c.d -P "${CMAKE_CURRENT_LIST_DIR}/WriteDepfile.cmake"
+ COMMAND ${CMAKE_COMMAND} -DOUTFILE=${CMAKE_CURRENT_BINARY_DIR}/topcc.c -DINFILE=topccdep.txt -DDEPFILE=topcc.c.d -P "${CMAKE_CURRENT_LIST_DIR}/WriteDepfile.cmake"
)
add_custom_target(topcc ALL DEPENDS topcc.c)
diff --git a/Tests/RunCMake/BuildDepends/DepfileSubdir/CMakeLists.txt b/Tests/RunCMake/BuildDepends/DepfileSubdir/CMakeLists.txt
index 06db47c..f131751 100644
--- a/Tests/RunCMake/BuildDepends/DepfileSubdir/CMakeLists.txt
+++ b/Tests/RunCMake/BuildDepends/DepfileSubdir/CMakeLists.txt
@@ -3,7 +3,7 @@ cmake_policy(SET CMP0116 NEW)
add_custom_command(
OUTPUT subcc.c
DEPFILE subcc.c.d
- COMMAND ${CMAKE_COMMAND} -DOUTFILE=subcc.c -DINFILE=subccdep.txt -DDEPFILE=subcc.c.d -P "${CMAKE_CURRENT_LIST_DIR}/../WriteDepfile.cmake"
+ COMMAND ${CMAKE_COMMAND} -DOUTFILE=${CMAKE_CURRENT_BINARY_DIR}/subcc.c -DINFILE=subccdep.txt -DDEPFILE=subcc.c.d -P "${CMAKE_CURRENT_LIST_DIR}/../WriteDepfile.cmake"
)
add_custom_target(subcc ALL DEPENDS subcc.c)
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 540a718..d1122d0 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -796,7 +796,10 @@ add_RunCMake_test(PrecompileHeaders -DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID}
add_RunCMake_test("UnityBuild")
add_RunCMake_test(CMakePresets -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE} -DCMake_TEST_JSON_SCHEMA=${CMake_TEST_JSON_SCHEMA})
-add_RunCMake_test(TransformDepfile)
+
+if(${CMAKE_GENERATOR} MATCHES "Make|Ninja")
+ add_RunCMake_test(TransformDepfile)
+endif()
if(WIN32)
add_RunCMake_test(Win32GenEx)
diff --git a/Tests/RunCMake/TransformDepfile/RunCMakeTest.cmake b/Tests/RunCMake/TransformDepfile/RunCMakeTest.cmake
index cb75eb0..9a38b95 100644
--- a/Tests/RunCMake/TransformDepfile/RunCMakeTest.cmake
+++ b/Tests/RunCMake/TransformDepfile/RunCMakeTest.cmake
@@ -3,11 +3,11 @@ include(RunCMake)
function(run_transform_depfile name)
set(RunCMake-check-file gccdepfile.cmake)
run_cmake_command(${name}-gcc
- ${CMAKE_COMMAND} -E cmake_transform_depfile gccdepfile ../ ${CMAKE_CURRENT_LIST_DIR}/${name}.d out.d
+ ${CMAKE_COMMAND} -E cmake_transform_depfile "${RunCMake_GENERATOR}" gccdepfile "${RunCMake_SOURCE_DIR}" "${RunCMake_SOURCE_DIR}/subdir" "${RunCMake_BINARY_DIR}" "${RunCMake_BINARY_DIR}/subdir" "${CMAKE_CURRENT_LIST_DIR}/${name}.d" out.d
)
set(RunCMake-check-file vstlog.cmake)
run_cmake_command(${name}-tlog
- ${CMAKE_COMMAND} -E cmake_transform_depfile vstlog ../ ${CMAKE_CURRENT_LIST_DIR}/${name}.d out.tlog
+ ${CMAKE_COMMAND} -E cmake_transform_depfile "${RunCMake_GENERATOR}" vstlog "${RunCMake_SOURCE_DIR}" "${RunCMake_SOURCE_DIR}/subdir" "${RunCMake_BINARY_DIR}" "${RunCMake_BINARY_DIR}/subdir" "${CMAKE_CURRENT_LIST_DIR}/${name}.d" out.tlog
)
endfunction()
diff --git a/Tests/RunCMake/TransformDepfile/deps-unix.d.txt b/Tests/RunCMake/TransformDepfile/deps-unix.d.txt
index 58770f2..fbdecc0 100644
--- a/Tests/RunCMake/TransformDepfile/deps-unix.d.txt
+++ b/Tests/RunCMake/TransformDepfile/deps-unix.d.txt
@@ -1,8 +1,8 @@
-../out1 \
+subdir/out1 \
/home/build/out2: \
- ../in1 \
+ subdir/in1 \
/home/build/in2
-../out3 \
+subdir/out3 \
/home/build/out4: \
- ../in3 \
+ subdir/in3 \
/home/build/in4
diff --git a/Tests/RunCMake/TransformDepfile/deps-unix.tlog.txt b/Tests/RunCMake/TransformDepfile/deps-unix.tlog.txt
index 2a26edf..70bac5d 100644
--- a/Tests/RunCMake/TransformDepfile/deps-unix.tlog.txt
+++ b/Tests/RunCMake/TransformDepfile/deps-unix.tlog.txt
@@ -1,6 +1,6 @@
-^../out1|/home/build/out2
-../in1
+^subdir/out1|/home/build/out2
+subdir/in1
/home/build/in2
-^../out3|/home/build/out4
-../in3
+^subdir/out3|/home/build/out4
+subdir/in3
/home/build/in4
diff --git a/Tests/RunCMake/TransformDepfile/deps-windows.d.txt b/Tests/RunCMake/TransformDepfile/deps-windows.d.txt
index 47b3ebf..e09ae37 100644
--- a/Tests/RunCMake/TransformDepfile/deps-windows.d.txt
+++ b/Tests/RunCMake/TransformDepfile/deps-windows.d.txt
@@ -1,8 +1,8 @@
-../out1 \
+subdir/out1 \
C:/build/out2: \
- ../in1 \
+ subdir/in1 \
C:/build/in2
-../out3 \
+subdir/out3 \
C:/build/out4: \
- ../in3 \
+ subdir/in3 \
C:/build/in4
diff --git a/Tests/RunCMake/TransformDepfile/deps-windows.tlog.txt b/Tests/RunCMake/TransformDepfile/deps-windows.tlog.txt
index 1e6024d..09f9e97 100644
--- a/Tests/RunCMake/TransformDepfile/deps-windows.tlog.txt
+++ b/Tests/RunCMake/TransformDepfile/deps-windows.tlog.txt
@@ -1,6 +1,6 @@
-^..\out1|C:\build\out2
-..\in1
+^subdir\out1|C:\build\out2
+subdir\in1
C:\build\in2
-^..\out3|C:\build\out4
-..\in3
+^subdir\out3|C:\build\out4
+subdir\in3
C:\build\in4
diff --git a/Tests/RunCMake/TransformDepfile/invalid-gcc-result.txt b/Tests/RunCMake/TransformDepfile/invalid-gcc-result.txt
index d00491f..0cfbf08 100644
--- a/Tests/RunCMake/TransformDepfile/invalid-gcc-result.txt
+++ b/Tests/RunCMake/TransformDepfile/invalid-gcc-result.txt
@@ -1 +1 @@
-1
+2
diff --git a/Tests/RunCMake/TransformDepfile/invalid-tlog-result.txt b/Tests/RunCMake/TransformDepfile/invalid-tlog-result.txt
index d00491f..0cfbf08 100644
--- a/Tests/RunCMake/TransformDepfile/invalid-tlog-result.txt
+++ b/Tests/RunCMake/TransformDepfile/invalid-tlog-result.txt
@@ -1 +1 @@
-1
+2