mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-05 22:00:10 -05:00
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:
committed by
Brad King
parent
3ea87bce69
commit
9fd9e448d0
@@ -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}")
|
||||
|
||||
Reference in New Issue
Block a user