Simplify the _default_cwd derivation

This commit is contained in:
Ben Boeckel 2010-12-17 10:23:54 -05:00
parent 992c74f3e0
commit d87bae7f74
1 changed files with 3 additions and 5 deletions

View File

@ -5,6 +5,8 @@ add_executable(WorkingDirectory main.cxx)
enable_testing()
set(EXECUTABLE_OUTPUT_PATH "${CMAKE_BINARY_DIR}/bin")
add_test(NAME WorkingDirectory1 COMMAND WorkingDirectory)
add_test(NAME WorkingDirectory2 COMMAND WorkingDirectory)
add_test(WorkingDirectory3 WorkingDirectory)
@ -21,8 +23,7 @@ set_tests_properties(WorkingDirectory2 PROPERTIES
PASS_REGULAR_EXPRESSION "Working directory: -->${_parent_dir}<--"
)
string(REGEX REPLACE "/[^/]*$" "" _wd_exe "${CMAKE_BINARY_DIR}")
get_filename_component(_default_cwd "${_wd_exe}" ABSOLUTE)
get_filename_component(_default_cwd "${EXECUTABLE_OUTPUT_PATH}" PATH)
set_tests_properties(WorkingDirectory3 PROPERTIES
PASS_REGULAR_EXPRESSION "Working directory: -->${_default_cwd}<--"
@ -42,9 +43,6 @@ set_tests_properties(WorkingDirectory5 PROPERTIES
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
PASS_REGULAR_EXPRESSION "Working directory: -->${_default_cwd}<--"
)