summaryrefslogtreecommitdiffstats
path: root/Modules/FindGTest.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-08-03 15:12:01 (GMT)
committerBrad King <brad.king@kitware.com>2016-08-03 15:14:29 (GMT)
commitff386d1121ec52854d522d3bb9c86fab286d58ef (patch)
tree3b1d9d71f628227661992346e791ebdd9f07fa80 /Modules/FindGTest.cmake
parent382c4fca6b895c2c7a68445918a8fd73a15e1f91 (diff)
downloadCMake-ff386d1121ec52854d522d3bb9c86fab286d58ef.zip
CMake-ff386d1121ec52854d522d3bb9c86fab286d58ef.tar.gz
CMake-ff386d1121ec52854d522d3bb9c86fab286d58ef.tar.bz2
Modules: Make imported targets fall back to `Release`
Find modules only detect Debug and Release configurations. All other configurations will fall back to the configuration listed as the first entry in `IMPORTED_CONFIGURATIONS`. Switch the order so that `Release` is listed first, as this is a better fallback than `Debug` for the `RelWithDebInfo` and `MinSizeRel` configurations. See issue #16091. This approach is recommended by documentation in `cmake-developer(7)` added by commit v3.2.0-rc1~286^2~1 (Help: Document IMPORTED_CONFIGURATIONS target property for Find modules, 2014-12-04).
Diffstat (limited to 'Modules/FindGTest.cmake')
-rw-r--r--Modules/FindGTest.cmake28
1 files changed, 14 insertions, 14 deletions
diff --git a/Modules/FindGTest.cmake b/Modules/FindGTest.cmake
index a7ffcfe..72032c7 100644
--- a/Modules/FindGTest.cmake
+++ b/Modules/FindGTest.cmake
@@ -226,13 +226,6 @@ if(GTEST_FOUND)
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
IMPORTED_LOCATION "${GTEST_LIBRARY}")
endif()
- if(EXISTS "${GTEST_LIBRARY_DEBUG}")
- set_property(TARGET GTest::GTest APPEND PROPERTY
- IMPORTED_CONFIGURATIONS DEBUG)
- set_target_properties(GTest::GTest PROPERTIES
- IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "CXX"
- IMPORTED_LOCATION_DEBUG "${GTEST_LIBRARY_DEBUG}")
- endif()
if(EXISTS "${GTEST_LIBRARY_RELEASE}")
set_property(TARGET GTest::GTest APPEND PROPERTY
IMPORTED_CONFIGURATIONS RELEASE)
@@ -240,6 +233,13 @@ if(GTEST_FOUND)
IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"
IMPORTED_LOCATION_RELEASE "${GTEST_LIBRARY_RELEASE}")
endif()
+ if(EXISTS "${GTEST_LIBRARY_DEBUG}")
+ set_property(TARGET GTest::GTest APPEND PROPERTY
+ IMPORTED_CONFIGURATIONS DEBUG)
+ set_target_properties(GTest::GTest PROPERTIES
+ IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "CXX"
+ IMPORTED_LOCATION_DEBUG "${GTEST_LIBRARY_DEBUG}")
+ endif()
endif()
if(NOT TARGET GTest::Main)
add_library(GTest::Main UNKNOWN IMPORTED)
@@ -250,13 +250,6 @@ if(GTEST_FOUND)
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
IMPORTED_LOCATION "${GTEST_MAIN_LIBRARY}")
endif()
- if(EXISTS "${GTEST_MAIN_LIBRARY_DEBUG}")
- set_property(TARGET GTest::Main APPEND PROPERTY
- IMPORTED_CONFIGURATIONS DEBUG)
- set_target_properties(GTest::Main PROPERTIES
- IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "CXX"
- IMPORTED_LOCATION_DEBUG "${GTEST_MAIN_LIBRARY_DEBUG}")
- endif()
if(EXISTS "${GTEST_MAIN_LIBRARY_RELEASE}")
set_property(TARGET GTest::Main APPEND PROPERTY
IMPORTED_CONFIGURATIONS RELEASE)
@@ -264,5 +257,12 @@ if(GTEST_FOUND)
IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"
IMPORTED_LOCATION_RELEASE "${GTEST_MAIN_LIBRARY_RELEASE}")
endif()
+ if(EXISTS "${GTEST_MAIN_LIBRARY_DEBUG}")
+ set_property(TARGET GTest::Main APPEND PROPERTY
+ IMPORTED_CONFIGURATIONS DEBUG)
+ set_target_properties(GTest::Main PROPERTIES
+ IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "CXX"
+ IMPORTED_LOCATION_DEBUG "${GTEST_MAIN_LIBRARY_DEBUG}")
+ endif()
endif()
endif()