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
This commit is contained in:
Matthew Woehlke
2017-09-14 12:28:26 -04:00
committed by Brad King
parent 3ea87bce69
commit 9fd9e448d0
+5 -4
View File
@@ -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}")