Simplify the _default_cwd derivation
This commit is contained in:
parent
992c74f3e0
commit
d87bae7f74
|
@ -5,6 +5,8 @@ add_executable(WorkingDirectory main.cxx)
|
||||||
|
|
||||||
enable_testing()
|
enable_testing()
|
||||||
|
|
||||||
|
set(EXECUTABLE_OUTPUT_PATH "${CMAKE_BINARY_DIR}/bin")
|
||||||
|
|
||||||
add_test(NAME WorkingDirectory1 COMMAND WorkingDirectory)
|
add_test(NAME WorkingDirectory1 COMMAND WorkingDirectory)
|
||||||
add_test(NAME WorkingDirectory2 COMMAND WorkingDirectory)
|
add_test(NAME WorkingDirectory2 COMMAND WorkingDirectory)
|
||||||
add_test(WorkingDirectory3 WorkingDirectory)
|
add_test(WorkingDirectory3 WorkingDirectory)
|
||||||
|
@ -21,8 +23,7 @@ set_tests_properties(WorkingDirectory2 PROPERTIES
|
||||||
PASS_REGULAR_EXPRESSION "Working directory: -->${_parent_dir}<--"
|
PASS_REGULAR_EXPRESSION "Working directory: -->${_parent_dir}<--"
|
||||||
)
|
)
|
||||||
|
|
||||||
string(REGEX REPLACE "/[^/]*$" "" _wd_exe "${CMAKE_BINARY_DIR}")
|
get_filename_component(_default_cwd "${EXECUTABLE_OUTPUT_PATH}" PATH)
|
||||||
get_filename_component(_default_cwd "${_wd_exe}" ABSOLUTE)
|
|
||||||
|
|
||||||
set_tests_properties(WorkingDirectory3 PROPERTIES
|
set_tests_properties(WorkingDirectory3 PROPERTIES
|
||||||
PASS_REGULAR_EXPRESSION "Working directory: -->${_default_cwd}<--"
|
PASS_REGULAR_EXPRESSION "Working directory: -->${_default_cwd}<--"
|
||||||
|
@ -42,9 +43,6 @@ set_tests_properties(WorkingDirectory5 PROPERTIES
|
||||||
PASS_REGULAR_EXPRESSION "Working directory: -->${_parent_dir}<--"
|
PASS_REGULAR_EXPRESSION "Working directory: -->${_parent_dir}<--"
|
||||||
)
|
)
|
||||||
|
|
||||||
string(REGEX REPLACE "/[^/]*$" "" _wd_exe "${CMAKE_BINARY_DIR}")
|
|
||||||
get_filename_component(_default_cwd "${_wd_exe}" ABSOLUTE)
|
|
||||||
|
|
||||||
set_tests_properties(WorkingDirectory6 PROPERTIES
|
set_tests_properties(WorkingDirectory6 PROPERTIES
|
||||||
PASS_REGULAR_EXPRESSION "Working directory: -->${_default_cwd}<--"
|
PASS_REGULAR_EXPRESSION "Working directory: -->${_default_cwd}<--"
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue