diff options
author | Robert Maynard <rmaynard@nvidia.com> | 2022-07-29 15:34:32 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2022-07-29 18:05:55 (GMT) |
commit | 1aa95e1a3b0f29ca35554b1bb003f714c315e047 (patch) | |
tree | 9de07c84aca90e0b6f8f5d2f05988a504a6ffa13 /Modules/FindGTest.cmake | |
parent | d566bd962df5b1bf0ec5d16e9e7affe592b8b3eb (diff) | |
download | CMake-1aa95e1a3b0f29ca35554b1bb003f714c315e047.zip CMake-1aa95e1a3b0f29ca35554b1bb003f714c315e047.tar.gz CMake-1aa95e1a3b0f29ca35554b1bb003f714c315e047.tar.bz2 |
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.cmake | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Modules/FindGTest.cmake b/Modules/FindGTest.cmake index 60bb401..92334e4 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) |