diff options
author | Brad King <brad.king@kitware.com> | 2017-11-21 18:00:13 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2017-11-21 18:00:24 (GMT) |
commit | baa19f658f947047dddac0228bcd52591829983d (patch) | |
tree | 762eef55ce555387089a7860881ff6efae67aeb9 /Modules | |
parent | daeadde88871f4e2473ce429f459ae8d6ed0ffb8 (diff) | |
parent | 70f9f62da86d43c61435ea2d58782ba470d8d282 (diff) | |
download | CMake-baa19f658f947047dddac0228bcd52591829983d.zip CMake-baa19f658f947047dddac0228bcd52591829983d.tar.gz CMake-baa19f658f947047dddac0228bcd52591829983d.tar.bz2 |
Merge topic 'gtest-fix-discovery'
70f9f62d GoogleTest: Fix multiple discovery on same target
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1510
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/GoogleTest.cmake | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/Modules/GoogleTest.cmake b/Modules/GoogleTest.cmake index 41bd1dc..3d47367 100644 --- a/Modules/GoogleTest.cmake +++ b/Modules/GoogleTest.cmake @@ -361,9 +361,32 @@ function(gtest_discover_tests TARGET) set(_TEST_LIST ${TARGET}_TESTS) endif() + get_property( + has_counter + TARGET ${TARGET} + PROPERTY CTEST_DISCOVERED_TEST_COUNTER + SET + ) + if(has_counter) + get_property( + counter + TARGET ${TARGET} + PROPERTY CTEST_DISCOVERED_TEST_COUNTER + ) + math(EXPR counter "${counter} + 1") + else() + set(counter 1) + endif() + set_property( + TARGET ${TARGET} + PROPERTY CTEST_DISCOVERED_TEST_COUNTER + ${counter} + ) + # Define rule to generate test list for aforementioned test executable - set(ctest_include_file "${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_include.cmake") - set(ctest_tests_file "${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_tests.cmake") + set(ctest_file_base "${CMAKE_CURRENT_BINARY_DIR}/${TARGET}[${counter}]") + set(ctest_include_file "${ctest_file_base}_include.cmake") + set(ctest_tests_file "${ctest_file_base}_tests.cmake") get_property(crosscompiling_emulator TARGET ${TARGET} PROPERTY CROSSCOMPILING_EMULATOR |