| 1 |
file(READ "${RunCMake_TEST_BINARY_DIR}/TARGET_INTERMEDIATE_DIR-generated.txt" dir) |
| 2 |
|
| 3 |
# Default Case |
| 4 |
set(expected "foo\\.dir") |
| 5 |
|
| 6 |
# Short Object Names |
| 7 |
if (CMAKE_INTERMEDIATE_DIR_STRATEGY STREQUAL "SHORT") |
| 8 |
if (RunCMake_GENERATOR MATCHES "Ninja|Make|Visual Studio") |
| 9 |
set(expected "[\\\\/][._]o[\\\\/][0-9a-f]+") |
| 10 |
endif() |
| 11 |
endif() |
| 12 |
|
| 13 |
# Xcode |
| 14 |
if (RunCMake_GENERATOR MATCHES "Xcode") |
| 15 |
set(expected "foo.build") |
| 16 |
endif() |
| 17 |
|
| 18 |
# Append Config subdirectory |
| 19 |
if (RunCMake_GENERATOR_IS_MULTI_CONFIG) |
| 20 |
string(APPEND expected "[\\\\/]Release") |
| 21 |
endif() |
| 22 |
|
| 23 |
# Xcode has additional paths |
| 24 |
if (NOT RunCMake_GENERATOR MATCHES "Xcode") |
| 25 |
string(APPEND expected "$") |
| 26 |
endif() |
| 27 |
|
| 28 |
if(NOT dir MATCHES "${expected}") |
| 29 |
set(RunCMake_TEST_FAILED "actual content:\n [[${dir}]]\nbut expected to match:\n [[${expected}]]") |
| 30 |
elseif(NOT IS_DIRECTORY "${dir}") |
| 31 |
set(RunCMake_TEST_FAILED "target intermediate directory does not exist: [[${dir}]]") |
| 32 |
else() |
| 33 |
file(GLOB object_files "${dir}/*${CMAKE_C_OUTPUT_EXTENSION}") |
| 34 |
if (NOT object_files) |
| 35 |
set(RunCMake_TEST_FAILED "no object files found in intermediate directory: [[${dir}]]") |
| 36 |
endif() |
| 37 |
if (CMAKE_INTERMEDIATE_DIR_STRATEGY STREQUAL "FULL") |
| 38 |
set(object_name "${dir}/simple.c${CMAKE_C_OUTPUT_EXTENSION}") |
| 39 |
if (RunCMake_GENERATOR MATCHES "Xcode|Visual Studio") |
| 40 |
set(object_name "${dir}/simple${CMAKE_C_OUTPUT_EXTENSION}") |
| 41 |
endif() |
| 42 |
if (NOT EXISTS "${object_name}") |
| 43 |
set(RunCMake_TEST_FAILED "simple.c object file not found in intermediate directory: [[${dir}]]") |
| 44 |
endif() |
| 45 |
endif() |
| 46 |
endif() |