summaryrefslogtreecommitdiff
path: root/Modules/FindGTest.cmake
diff options
context:
space:
mode:
authorRobert Maynard <rmaynard@nvidia.com>2022-07-29 11:34:32 -0400
committerBrad King <brad.king@kitware.com>2022-07-29 14:05:55 -0400
commit1aa95e1a3b0f29ca35554b1bb003f714c315e047 (patch)
tree9de07c84aca90e0b6f8f5d2f05988a504a6ffa13 /Modules/FindGTest.cmake
parentd566bd962df5b1bf0ec5d16e9e7affe592b8b3eb (diff)
downloadcmake-1aa95e1a3b0f29ca35554b1bb003f714c315e047.tar.gz
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.
Diffstat (limited to 'Modules/FindGTest.cmake')
-rw-r--r--Modules/FindGTest.cmake2
1 files changed, 1 insertions, 1 deletions
diff --git a/Modules/FindGTest.cmake b/Modules/FindGTest.cmake
index 60bb401032..92334e44e8 100644
--- a/Modules/FindGTest.cmake
+++ b/Modules/FindGTest.cmake
@@ -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)