Comply to CMake's CMP0037. (#267)

Test target names are generated from the directory and
source filename. Now "/"s are replaced by "."s which are
allowed by CMP0037.
master
Wolfgang Hess 2017-05-08 18:09:39 +02:00 committed by GitHub
parent 772d02c00e
commit c664d7b966
1 changed files with 3 additions and 1 deletions

View File

@ -98,7 +98,9 @@ foreach(ABS_FIL ${ALL_TESTS})
file(RELATIVE_PATH REL_FIL ${PROJECT_SOURCE_DIR} ${ABS_FIL})
get_filename_component(DIR ${REL_FIL} DIRECTORY)
get_filename_component(FIL_WE ${REL_FIL} NAME_WE)
google_test("${DIR}/${FIL_WE}" ${ABS_FIL})
# Replace slashes as required for CMP0037.
string(REPLACE "/" "." TEST_TARGET_NAME "${DIR}/${FIL_WE}")
google_test("${TEST_TARGET_NAME}" ${ABS_FIL})
endforeach()
target_include_directories(${PROJECT_NAME} SYSTEM PUBLIC