mirror of
https://github.com/Kitware/CMake.git
synced 2026-08-04 23:00:54 +00: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)
|
_gtest_append_debugs(GTEST_MAIN_LIBRARIES GTEST_MAIN_LIBRARY)
|
||||||
set(GTEST_BOTH_LIBRARIES ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES})
|
set(GTEST_BOTH_LIBRARIES ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES})
|
||||||
|
|
||||||
include(CMakeFindDependencyMacro)
|
find_package(Threads QUIET)
|
||||||
find_dependency(Threads)
|
|
||||||
|
|
||||||
if(NOT TARGET GTest::GTest)
|
if(NOT TARGET GTest::GTest)
|
||||||
add_library(GTest::GTest UNKNOWN IMPORTED)
|
add_library(GTest::GTest UNKNOWN IMPORTED)
|
||||||
set_target_properties(GTest::GTest PROPERTIES
|
if(TARGET Threads::Threads)
|
||||||
INTERFACE_LINK_LIBRARIES "Threads::Threads")
|
set_target_properties(GTest::GTest PROPERTIES
|
||||||
|
INTERFACE_LINK_LIBRARIES Threads::Threads)
|
||||||
|
endif()
|
||||||
if(GTEST_INCLUDE_DIRS)
|
if(GTEST_INCLUDE_DIRS)
|
||||||
set_target_properties(GTest::GTest PROPERTIES
|
set_target_properties(GTest::GTest PROPERTIES
|
||||||
INTERFACE_INCLUDE_DIRECTORIES "${GTEST_INCLUDE_DIRS}")
|
INTERFACE_INCLUDE_DIRECTORIES "${GTEST_INCLUDE_DIRS}")
|
||||||
|
|||||||
Reference in New Issue
Block a user