From d2e9478321813fc7633b9fddd6fd4190dbd705ec Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 2 Mar 2022 11:03:25 -0500 Subject: Tests: Add RunCMake.CommandLine ExplicitiDirs explicit work directory Verify that the work directory is not selected as the source or build tree. Issue: #23285 --- Tests/RunCMake/CommandLine/RunCMakeTest.cmake | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index 8084983..081ee3f 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}) -- cgit v0.12