summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake
diff options
context:
space:
mode:
authorOrkun Tokdemir <ilhanorkuntokdemir@gmail.com>2024-01-08 13:36:45 (GMT)
committerBrad King <brad.king@kitware.com>2024-01-09 15:44:43 (GMT)
commit7198f0d149a05cae8dec3da601e4dd4fc8526276 (patch)
tree672973bdc3951a22f2af27416dd9f3e133ac14a9 /Tests/RunCMake
parent5162ff64d4f069a1fabf0178869ddaaff9045c88 (diff)
downloadCMake-7198f0d149a05cae8dec3da601e4dd4fc8526276.zip
CMake-7198f0d149a05cae8dec3da601e4dd4fc8526276.tar.gz
CMake-7198f0d149a05cae8dec3da601e4dd4fc8526276.tar.bz2
Makefile: Fix double escaping when DEPFILE is used
In commit cfd8a5ac1f (Makefiles: Add support of DEPFILE for add_custom_command, 2020-12-04, v3.20.0-rc1~237^2~1) we added a `ConvertToOutputPath` call on a path given to the `depends` field of `WriteMakeRule`. The latter already handles escaping for Makefile syntax. Fixes: #25554
Diffstat (limited to 'Tests/RunCMake')
-rw-r--r--Tests/RunCMake/BuildDepends/CustomCommandDepfile.cmake11
-rw-r--r--Tests/RunCMake/BuildDepends/DepfileSubdirWithSpace/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/BuildDepends/DepfileSubdirWithSpace/path with space/CMakeLists.txt9
3 files changed, 22 insertions, 0 deletions
diff --git a/Tests/RunCMake/BuildDepends/CustomCommandDepfile.cmake b/Tests/RunCMake/BuildDepends/CustomCommandDepfile.cmake
index 19c09c8..c3725a4 100644
--- a/Tests/RunCMake/BuildDepends/CustomCommandDepfile.cmake
+++ b/Tests/RunCMake/BuildDepends/CustomCommandDepfile.cmake
@@ -24,6 +24,17 @@ add_library(toplib STATIC toplib.c)
add_subdirectory(DepfileSubdir)
+set(TEST_SPACE 1)
+if(CMAKE_GENERATOR STREQUAL "Unix Makefiles")
+ execute_process(COMMAND "${CMAKE_MAKE_PROGRAM}" no_such_target --version RESULT_VARIABLE res OUTPUT_VARIABLE out ERROR_VARIABLE out)
+ if(NOT res EQUAL 0 OR NOT out MATCHES "GNU")
+ set(TEST_SPACE 0)
+ endif()
+endif()
+if(TEST_SPACE)
+ add_subdirectory(DepfileSubdirWithSpace)
+endif()
+
add_custom_command(
OUTPUT toplib2.c
DEPFILE toplib2.c.d
diff --git a/Tests/RunCMake/BuildDepends/DepfileSubdirWithSpace/CMakeLists.txt b/Tests/RunCMake/BuildDepends/DepfileSubdirWithSpace/CMakeLists.txt
new file mode 100644
index 0000000..204f740
--- /dev/null
+++ b/Tests/RunCMake/BuildDepends/DepfileSubdirWithSpace/CMakeLists.txt
@@ -0,0 +1,2 @@
+
+add_subdirectory("path with space")
diff --git a/Tests/RunCMake/BuildDepends/DepfileSubdirWithSpace/path with space/CMakeLists.txt b/Tests/RunCMake/BuildDepends/DepfileSubdirWithSpace/path with space/CMakeLists.txt
new file mode 100644
index 0000000..37c0a57
--- /dev/null
+++ b/Tests/RunCMake/BuildDepends/DepfileSubdirWithSpace/path with space/CMakeLists.txt
@@ -0,0 +1,9 @@
+
+add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/dummy.txt"
+ COMMAND ${CMAKE_COMMAND} -E touch "${CMAKE_CURRENT_BINARY_DIR}/dummy.txt"
+ DEPFILE dummy.txt.d
+)
+
+add_custom_target(subdir_space ALL
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/dummy.txt"
+)