blob: 5fbcd2ad538188feab2437a0d50830cd00ceef27 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
cmake_minimum_required(VERSION 2.6)
project(WorkingDirectoryProj)
add_executable(WorkingDirectory main.cxx)
enable_testing()
add_test(NAME WorkingDirectory1 COMMAND WorkingDirectory)
add_test(NAME WorkingDirectory2 COMMAND WorkingDirectory)
add_test(WorkingDirectory3 WorkingDirectory)
set_tests_properties(WorkingDirectory1 PROPERTIES
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
PASS_REGULAR_EXPRESSION "Working directory: ${CMAKE_BINARY_DIR}"
)
string(REGEX REPLACE "/[^/]*$" "" _parent_dir "${CMAKE_BINARY_DIR}")
set_tests_properties(WorkingDirectory2 PROPERTIES
WORKING_DIRECTORY "${CMAKE_BINARY_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(WorkingDirectory3 PROPERTIES
PASS_REGULAR_EXPRESSION "Working directory: ${_default_cwd}"
)
|