summaryrefslogtreecommitdiffstats
path: root/Modules/FindGTest.cmake
diff options
context:
space:
mode:
authorMatthew Woehlke <matthew.woehlke@kitware.com>2017-09-14 16:28:26 (GMT)
committerBrad King <brad.king@kitware.com>2017-09-14 18:20:13 (GMT)
commit9fd9e448d0e57fecb1fea2e27c2c89dabc2ad23d (patch)
tree5dad64b91ab3552b3adfea24a261b1a5a4602719 /Modules/FindGTest.cmake
parent3ea87bce69d1b6120b227fed3838f1bc9ab45db1 (diff)
downloadCMake-9fd9e448d0e57fecb1fea2e27c2c89dabc2ad23d.zip
CMake-9fd9e448d0e57fecb1fea2e27c2c89dabc2ad23d.tar.gz
CMake-9fd9e448d0e57fecb1fea2e27c2c89dabc2ad23d.tar.bz2
FindGTest: Avoid using find_dependency in a find module
The `find_dependency` macro is not meant for use in find modules. Instead use plain `find_package` for the Threads package. Assume that if it is not found then it isn't needed on the current platform. Issue: #17257
Diffstat (limited to 'Modules/FindGTest.cmake')
-rw-r--r--Modules/FindGTest.cmake9
1 files changed, 5 insertions, 4 deletions
diff --git a/Modules/FindGTest.cmake b/Modules/FindGTest.cmake
index cb71ef1..889a68d 100644
--- a/Modules/FindGTest.cmake
+++ b/Modules/FindGTest.cmake
@@ -151,13 +151,14 @@ if(GTEST_FOUND)
_gtest_append_debugs(GTEST_MAIN_LIBRARIES GTEST_MAIN_LIBRARY)
set(GTEST_BOTH_LIBRARIES ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES})
- include(CMakeFindDependencyMacro)
- find_dependency(Threads)
+ find_package(Threads QUIET)
if(NOT TARGET GTest::GTest)
add_library(GTest::GTest UNKNOWN IMPORTED)
- set_target_properties(GTest::GTest PROPERTIES
- INTERFACE_LINK_LIBRARIES "Threads::Threads")
+ if(TARGET Threads::Threads)
+ set_target_properties(GTest::GTest PROPERTIES
+ INTERFACE_LINK_LIBRARIES Threads::Threads)
+ endif()
if(GTEST_INCLUDE_DIRS)
set_target_properties(GTest::GTest PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${GTEST_INCLUDE_DIRS}")