From c664d7b966d5506248ac9ffa74a94c1d2bbd1adf Mon Sep 17 00:00:00 2001 From: Wolfgang Hess Date: Mon, 8 May 2017 18:09:39 +0200 Subject: [PATCH] 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. --- CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6379c39..0adc2af 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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