summaryrefslogtreecommitdiffstats
path: root/Tests/TestsWorkingDirectory
diff options
context:
space:
mode:
authorKyle Edwards <kyle.edwards@kitware.com>2023-09-26 18:45:32 (GMT)
committerBrad King <brad.king@kitware.com>2024-02-27 19:36:40 (GMT)
commit495d0da36bf0a8eaf92a3dfb901dae632b83a50a (patch)
tree461835df547bc056106742593f9217c9c48f3037 /Tests/TestsWorkingDirectory
parentde446077f7bfec90332f4edc188b838d4ab31bec (diff)
downloadCMake-495d0da36bf0a8eaf92a3dfb901dae632b83a50a.zip
CMake-495d0da36bf0a8eaf92a3dfb901dae632b83a50a.tar.gz
CMake-495d0da36bf0a8eaf92a3dfb901dae632b83a50a.tar.bz2
Tests: Use real directory in TestsWorkingDirectory
Diffstat (limited to 'Tests/TestsWorkingDirectory')
-rw-r--r--Tests/TestsWorkingDirectory/CMakeLists.txt14
-rw-r--r--Tests/TestsWorkingDirectory/subdir/CMakeLists.txt14
2 files changed, 16 insertions, 12 deletions
diff --git a/Tests/TestsWorkingDirectory/CMakeLists.txt b/Tests/TestsWorkingDirectory/CMakeLists.txt
index f77370c..c7b58a9 100644
--- a/Tests/TestsWorkingDirectory/CMakeLists.txt
+++ b/Tests/TestsWorkingDirectory/CMakeLists.txt
@@ -7,30 +7,32 @@ enable_testing()
set(EXECUTABLE_OUTPUT_PATH "${CMAKE_BINARY_DIR}/bin")
-add_test(NAME WorkingDirectory0 COMMAND WorkingDirectory "${CMAKE_BINARY_DIR}")
+file(REAL_PATH "${CMAKE_BINARY_DIR}" _real_binary_dir)
-add_test(NAME WorkingDirectory1 COMMAND WorkingDirectory "${CMAKE_BINARY_DIR}")
+add_test(NAME WorkingDirectory0 COMMAND WorkingDirectory "${_real_binary_dir}")
+
+add_test(NAME WorkingDirectory1 COMMAND WorkingDirectory "${_real_binary_dir}")
set_tests_properties(WorkingDirectory1 PROPERTIES
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
)
-string(REGEX REPLACE "/[^/]*$" "" _parent_dir "${CMAKE_BINARY_DIR}")
+string(REGEX REPLACE "/[^/]*$" "" _parent_dir "${_real_binary_dir}")
add_test(NAME WorkingDirectory2 COMMAND WorkingDirectory "${_parent_dir}")
set_tests_properties(WorkingDirectory2 PROPERTIES
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/.."
)
-set(_default_cwd "${CMAKE_BINARY_DIR}")
+set(_default_cwd "${_real_binary_dir}")
# FIXME: How to deal with /debug, /release, etc. with VS or Xcode?
if(${CMAKE_GENERATOR} MATCHES "Makefiles")
add_test(WorkingDirectory3 ${EXECUTABLE_OUTPUT_PATH}/WorkingDirectory ${_default_cwd})
endif()
-add_test(NAME WorkingDirectory4 WORKING_DIRECTORY ${CMAKE_BINARY_DIR} COMMAND WorkingDirectory ${CMAKE_BINARY_DIR})
+add_test(NAME WorkingDirectory4 WORKING_DIRECTORY ${CMAKE_BINARY_DIR} COMMAND WorkingDirectory ${_real_binary_dir})
-string(REGEX REPLACE "/[^/]*$" "" _parent_dir "${CMAKE_BINARY_DIR}")
+string(REGEX REPLACE "/[^/]*$" "" _parent_dir "${_real_binary_dir}")
add_test(NAME WorkingDirectory5 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/.. COMMAND WorkingDirectory ${_parent_dir})
diff --git a/Tests/TestsWorkingDirectory/subdir/CMakeLists.txt b/Tests/TestsWorkingDirectory/subdir/CMakeLists.txt
index c16b1db..a7f32b8 100644
--- a/Tests/TestsWorkingDirectory/subdir/CMakeLists.txt
+++ b/Tests/TestsWorkingDirectory/subdir/CMakeLists.txt
@@ -1,27 +1,29 @@
-add_test(NAME WorkingDirectory-Subdir0 COMMAND WorkingDirectory "${CMAKE_CURRENT_BINARY_DIR}")
+file(REAL_PATH "${CMAKE_CURRENT_BINARY_DIR}" _real_current_binary_dir)
-add_test(NAME WorkingDirectory-Subdir1 COMMAND WorkingDirectory "${CMAKE_CURRENT_BINARY_DIR}")
+add_test(NAME WorkingDirectory-Subdir0 COMMAND WorkingDirectory "${_real_current_binary_dir}")
+
+add_test(NAME WorkingDirectory-Subdir1 COMMAND WorkingDirectory "${_real_current_binary_dir}")
set_tests_properties(WorkingDirectory-Subdir1 PROPERTIES
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
)
-string(REGEX REPLACE "/[^/]*$" "" _parent_dir "${CMAKE_CURRENT_BINARY_DIR}")
+string(REGEX REPLACE "/[^/]*$" "" _parent_dir "${_real_current_binary_dir}")
add_test(NAME WorkingDirectory-Subdir2 COMMAND WorkingDirectory "${_parent_dir}")
set_tests_properties(WorkingDirectory-Subdir2 PROPERTIES
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/.."
)
-set(_default_cwd "${CMAKE_CURRENT_BINARY_DIR}")
+set(_default_cwd "${_real_current_binary_dir}")
# FIXME: How to deal with /debug, /release, etc. with VS or Xcode?
if(${CMAKE_GENERATOR} MATCHES "Makefiles")
add_test(WorkingDirectory-Subdir3 ${EXECUTABLE_OUTPUT_PATH}/WorkingDirectory ${_default_cwd})
endif()
-add_test(NAME WorkingDirectory-Subdir4 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND WorkingDirectory ${CMAKE_CURRENT_BINARY_DIR})
+add_test(NAME WorkingDirectory-Subdir4 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND WorkingDirectory ${_real_current_binary_dir})
-string(REGEX REPLACE "/[^/]*$" "" _parent_dir "${CMAKE_CURRENT_BINARY_DIR}")
+string(REGEX REPLACE "/[^/]*$" "" _parent_dir "${_real_current_binary_dir}")
add_test(NAME WorkingDirectory-Subdir5 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/.. COMMAND WorkingDirectory ${_parent_dir})