summaryrefslogtreecommitdiff
path: root/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-03-02 11:03:25 -0500
committerBrad King <brad.king@kitware.com>2022-03-02 12:21:34 -0500
commitd2e9478321813fc7633b9fddd6fd4190dbd705ec (patch)
tree19a6702f70b3835309fc95724b527caeebd9e0a1 /Tests/RunCMake/CommandLine/RunCMakeTest.cmake
parent78e8f1145670ad7326c4d06502315741805aa304 (diff)
downloadcmake-d2e9478321813fc7633b9fddd6fd4190dbd705ec.tar.gz
Tests: Add RunCMake.CommandLine ExplicitiDirs explicit work directory
Verify that the work directory is not selected as the source or build tree. Issue: #23285
Diffstat (limited to 'Tests/RunCMake/CommandLine/RunCMakeTest.cmake')
-rw-r--r--Tests/RunCMake/CommandLine/RunCMakeTest.cmake6
1 files changed, 6 insertions, 0 deletions
diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
index 8084983e33..081ee3f40f 100644
--- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
@@ -155,10 +155,14 @@ message(STATUS "CMAKE_BINARY_DIR='${CMAKE_BINARY_DIR}'")
set(source_dir ${RunCMake_SOURCE_DIR}/ExplicitDirs)
set(binary_dir ${RunCMake_BINARY_DIR}/ExplicitDirs-build)
+ set(working_dir ${RunCMake_BINARY_DIR}/ExplicitDirs-cwd)
set(RunCMake_TEST_SOURCE_DIR "${source_dir}")
set(RunCMake_TEST_BINARY_DIR "${binary_dir}")
+ file(MAKE_DIRECTORY "${working_dir}")
+ set(RunCMake_TEST_COMMAND_WORKING_DIRECTORY "${working_dir}")
+
file(REMOVE_RECURSE "${binary_dir}")
run_cmake_with_options(ExplicitDirs-S-arg -S ${source_dir} ${binary_dir})
run_cmake_with_options(ExplicitDirs-S-arg-reverse-order ${binary_dir} -S${source_dir} )
@@ -194,6 +198,8 @@ message(STATUS "CMAKE_BINARY_DIR='${CMAKE_BINARY_DIR}'")
run_cmake_with_options(ExplicitDirs-B-S -B${binary_dir} -S${source_dir})
run_cmake_with_options(ExplicitDirs-B-S-extra-path -B${binary_dir} -S${source_dir} /extra/path/)
+ unset(RunCMake_TEST_COMMAND_WORKING_DIRECTORY)
+
message("copied to ${RunCMake_TEST_BINARY_DIR}/initial-cache.txt")
file(COPY ${RunCMake_SOURCE_DIR}/C_buildsrcdir/initial-cache.txt DESTINATION ${RunCMake_TEST_BINARY_DIR})