mirror of
https://github.com/Kitware/CMake.git
synced 2025-12-30 18:29:37 -06:00
FindGTest: Create the gmock targets only when GTest has been found
When we introduced the `GTest::gmock` and `GTest::gmock_main` targets in
commit 50bf457a0d (FindGTest: Add target for gmock library, 2021-10-17,
v3.23.0-rc1~321^2) we failed to handle the case where GTest isn't found.
Don't construct gmock targets that depend on non-existent gtest targets
when gtest failed to be found.
This commit is contained in:
committed by
Brad King
parent
d566bd962d
commit
1aa95e1a3b
@@ -314,7 +314,7 @@ if(GTest_FOUND)
|
||||
__gtest_define_backwards_compatible_library_targets()
|
||||
endif()
|
||||
|
||||
if(GMock_FOUND)
|
||||
if(GMock_FOUND AND GTest_FOUND)
|
||||
if(NOT TARGET GTest::gmock)
|
||||
__gtest_determine_library_type(GMOCK_LIBRARY)
|
||||
add_library(GTest::gmock ${GMOCK_LIBRARY_TYPE} IMPORTED)
|
||||
|
||||
Reference in New Issue
Block a user