From 562ef57b4fd827ce9732964d478bd9e182778c97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Milo=C5=A1=20Komar=C4=8Devi=C4=87?= <4973094+kmilos@users.noreply.github.com> Date: Fri, 21 Jul 2023 13:57:33 +0200 Subject: [PATCH] Use CMake config mode for gMock detection --- unitTests/CMakeLists.txt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/unitTests/CMakeLists.txt b/unitTests/CMakeLists.txt index b18e039312..57b59e8565 100644 --- a/unitTests/CMakeLists.txt +++ b/unitTests/CMakeLists.txt @@ -1,4 +1,8 @@ -find_package(GTest REQUIRED) +# Prefer using Google supplied CMake config as built-in module is buggy before 3.23 +find_package(GTest CONFIG) +if(NOT GTest_FOUND) + find_package(GTest REQUIRED) +endif() # video support. if( EXV_ENABLE_VIDEO ) @@ -44,7 +48,7 @@ target_compile_definitions(unit_tests target_link_libraries(unit_tests PRIVATE exiv2lib - GTest::gtest_main + GTest::gmock_main std::filesystem )