From 9fd9e448d0e57fecb1fea2e27c2c89dabc2ad23d Mon Sep 17 00:00:00 2001 From: Matthew Woehlke Date: Thu, 14 Sep 2017 12:28:26 -0400 Subject: 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 --- Modules/FindGTest.cmake | 9 +++++---- 1 file 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}") -- cgit v0.12