فهرست منبع

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.
Robert Maynard 3 سال پیش
والد
کامیت
1aa95e1a3b
1فایلهای تغییر یافته به همراه1 افزوده شده و 1 حذف شده
  1. 1 1
      Modules/FindGTest.cmake

+ 1 - 1
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)