diff --git a/cmake/test/gtest.cmake b/cmake/test/gtest.cmake index 78da186c3..86f1e4b43 100644 --- a/cmake/test/gtest.cmake +++ b/cmake/test/gtest.cmake @@ -426,12 +426,21 @@ else() set(GMOCK_MAIN_LIBRARIES ${GMOCK_MAIN_LIBRARIES} CACHE INTERNAL "") set(GMOCK_BOTH_LIBRARIES ${GMOCK_BOTH_LIBRARIES} CACHE INTERNAL "") - set(GTEST_FOUND ${GMOCK_FOUND} CACHE INTERNAL "") - set(GTEST_INCLUDE_DIRS ${GMOCK_INCLUDE_DIRS} CACHE INTERNAL "") - set(GTEST_LIBRARY_DIRS ${GMOCK_LIBRARY_DIRS} CACHE INTERNAL "") - set(GTEST_LIBRARIES ${GMOCK_LIBRARIES} CACHE INTERNAL "") - set(GTEST_MAIN_LIBRARIES ${GMOCK_MAIN_LIBRARIES} CACHE INTERNAL "") - set(GTEST_BOTH_LIBRARIES ${GMOCK_BOTH_LIBRARIES} CACHE INTERNAL "") + if(GTEST_FOUND) + set(GTEST_FOUND ${GTEST_FOUND} CACHE INTERNAL "") + set(GTEST_INCLUDE_DIRS ${GTEST_INCLUDE_DIRS} CACHE INTERNAL "") + set(GTEST_LIBRARY_DIRS ${GTEST_LIBRARY_DIRS} CACHE INTERNAL "") + set(GTEST_LIBRARIES ${GTEST_LIBRARIES} CACHE INTERNAL "") + set(GTEST_MAIN_LIBRARIES ${GTEST_MAIN_LIBRARIES} CACHE INTERNAL "") + set(GTEST_BOTH_LIBRARIES ${GTEST_BOTH_LIBRARIES} CACHE INTERNAL "") + else() + set(GTEST_FOUND ${GMOCK_FOUND} CACHE INTERNAL "") + set(GTEST_INCLUDE_DIRS ${GMOCK_INCLUDE_DIRS} CACHE INTERNAL "") + set(GTEST_LIBRARY_DIRS ${GMOCK_LIBRARY_DIRS} CACHE INTERNAL "") + set(GTEST_LIBRARIES ${GMOCK_LIBRARIES} CACHE INTERNAL "") + set(GTEST_MAIN_LIBRARIES ${GMOCK_MAIN_LIBRARIES} CACHE INTERNAL "") + set(GTEST_BOTH_LIBRARIES ${GMOCK_BOTH_LIBRARIES} CACHE INTERNAL "") + endif() elseif(GTEST_FOUND) message(STATUS "Found gtest: gtests will be built") set(GTEST_FOUND ${GTEST_FOUND} CACHE INTERNAL "")