Skip to content

Commit

Permalink
Try using find_package to find GTest instead of guessing.
Browse files Browse the repository at this point in the history
  • Loading branch information
EpsilonPrime committed Feb 21, 2024
1 parent 60904d2 commit f5a8780
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 0 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,16 @@ find_package(Protobuf QUIET CONFIG)
if(${Protobuf_FOUND})
message(STATUS "Modern protobuf library located.")
set(ABSL_INCLUDED_WITH_PROTOBUF ON)
set(GOOGLETEST_INCLUDED_WITH_PROTOBUF OFF)
else()
find_package(Protobuf QUIET)
if(${Protobuf_FOUND})
message(STATUS "Legacy protobuf library located.")
include_directories(${Protobuf_INCLUDE_DIRS})
set(ABSL_INCLUDED_WITH_PROTOBUF OFF)
set(GOOGLETEST_INCLUDED_WITH_PROTOBUF OFF)
else()
message(STATUS "Fetching external protobuf library.")
include(third_party/protobuf.cmake)
set(ABSL_INCLUDED_WITH_PROTOBUF ON)
set(GOOGLETEST_INCLUDED_WITH_PROTOBUF ON)
endif()
endif()

Expand Down
3 changes: 2 additions & 1 deletion third_party/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ include(datetime.cmake)

add_subdirectory(fmt)

if(NOT ${GOOGLETEST_INCLUDED_WITH_PROTOBUF})
find_package(GTest QUIET)
if(NOT ${GTEST_FOUND})
message(STATUS "Using bundled GoogleTest library.")
add_subdirectory(googletest)
endif()
Expand Down

0 comments on commit f5a8780

Please sign in to comment.