summaryrefslogtreecommitdiff
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-11-24 13:40:04 +0000
committerKitware Robot <kwrobot@kitware.com>2020-11-24 08:41:23 -0500
commit6b4bb3bf7fe07ef3bea52779824ccc54bf3e622b (patch)
tree881328edfc7a84bf8423e596ab8c386f0a42bbcf /Tests
parent2ca901637667ff7ab3eee8546d3f129cb0f492bd (diff)
parent36921d2d231632768bba8dfb33f86fb92e695b43 (diff)
downloadcmake-6b4bb3bf7fe07ef3bea52779824ccc54bf3e622b.tar.gz
Merge topic 'xcode-cc-work-dir' into release-3.19
36921d2d23 Xcode: Fix custom command work-dir placeholders in "new build system" Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !5527
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/add_custom_command/PrintDir.cmake1
-rw-r--r--Tests/RunCMake/add_custom_command/RunCMakeTest.cmake15
-rw-r--r--Tests/RunCMake/add_custom_command/WorkingDirectory-build-multi-config-stdout.txt1
-rw-r--r--Tests/RunCMake/add_custom_command/WorkingDirectory-build-single-config-stdout.txt1
-rw-r--r--Tests/RunCMake/add_custom_command/WorkingDirectory.cmake9
5 files changed, 27 insertions, 0 deletions
diff --git a/Tests/RunCMake/add_custom_command/PrintDir.cmake b/Tests/RunCMake/add_custom_command/PrintDir.cmake
new file mode 100644
index 0000000000..0a7b646078
--- /dev/null
+++ b/Tests/RunCMake/add_custom_command/PrintDir.cmake
@@ -0,0 +1 @@
+message(STATUS "WorkingDir='${CMAKE_CURRENT_BINARY_DIR}'")
diff --git a/Tests/RunCMake/add_custom_command/RunCMakeTest.cmake b/Tests/RunCMake/add_custom_command/RunCMakeTest.cmake
index 96642faf1c..aac085dc17 100644
--- a/Tests/RunCMake/add_custom_command/RunCMakeTest.cmake
+++ b/Tests/RunCMake/add_custom_command/RunCMakeTest.cmake
@@ -27,3 +27,18 @@ set(RunCMake_TEST_NO_CLEAN 1)
run_cmake_command(AssigningMultipleTargets-build ${CMAKE_COMMAND} --build .)
unset(RunCMake_TEST_BINARY_DIR)
unset(RunCMake_TEST_NO_CLEAN)
+
+if(NOT RunCMake_GENERATOR STREQUAL "Ninja Multi-Config")
+ run_cmake(WorkingDirectory)
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/WorkingDirectory-build)
+ set(RunCMake_TEST_NO_CLEAN 1)
+ if(RunCMake_GENERATOR_IS_MULTI_CONFIG)
+ set(RunCMake-stdout-file WorkingDirectory-build-multi-config-stdout.txt)
+ else()
+ set(RunCMake-stdout-file WorkingDirectory-build-single-config-stdout.txt)
+ endif()
+ run_cmake_command(WorkingDirectory-build ${CMAKE_COMMAND} --build . --config Debug)
+ unset(RunCMake-stdout-file)
+ unset(RunCMake_TEST_BINARY_DIR)
+ unset(RunCMake_TEST_NO_CLEAN)
+endif()
diff --git a/Tests/RunCMake/add_custom_command/WorkingDirectory-build-multi-config-stdout.txt b/Tests/RunCMake/add_custom_command/WorkingDirectory-build-multi-config-stdout.txt
new file mode 100644
index 0000000000..95ecf424fe
--- /dev/null
+++ b/Tests/RunCMake/add_custom_command/WorkingDirectory-build-multi-config-stdout.txt
@@ -0,0 +1 @@
+-- WorkingDir='[^']*/Tests/RunCMake/add_custom_command/WorkingDirectory-build/Debug'
diff --git a/Tests/RunCMake/add_custom_command/WorkingDirectory-build-single-config-stdout.txt b/Tests/RunCMake/add_custom_command/WorkingDirectory-build-single-config-stdout.txt
new file mode 100644
index 0000000000..1db56ae254
--- /dev/null
+++ b/Tests/RunCMake/add_custom_command/WorkingDirectory-build-single-config-stdout.txt
@@ -0,0 +1 @@
+-- WorkingDir='[^']*/Tests/RunCMake/add_custom_command/WorkingDirectory-build'
diff --git a/Tests/RunCMake/add_custom_command/WorkingDirectory.cmake b/Tests/RunCMake/add_custom_command/WorkingDirectory.cmake
new file mode 100644
index 0000000000..65b72506e5
--- /dev/null
+++ b/Tests/RunCMake/add_custom_command/WorkingDirectory.cmake
@@ -0,0 +1,9 @@
+add_custom_target(mkdir COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>")
+add_custom_command(
+ OUTPUT out.txt
+ COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/PrintDir.cmake
+ WORKING_DIRECTORY ${CMAKE_CFG_INTDIR}
+ )
+set_property(SOURCE out.txt PROPERTY SYMBOLIC 1)
+add_custom_target(drive ALL DEPENDS out.txt)
+add_dependencies(drive mkdir)