Skip to content

Commit

Permalink
Merge pull request #121 from joto/only-tests-need-protobuf
Browse files Browse the repository at this point in the history
Only tests need Protobuf library
  • Loading branch information
joto authored Dec 20, 2024
2 parents ead6d6c + 8a0aed1 commit d14dcae
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,17 @@ endif()
#
#-----------------------------------------------------------------------------

# This is needed for the protobuf_generate_cpp() function to work on newer
# versions of the Protobuf CMake config.
set(protobuf_MODULE_COMPATIBLE ON CACHE BOOL "")

# This is needed so that we pick up the (more modern) CONFIG mode cmake file
# before the (older) MODULE mode cmake config file. Seems to be needed on macOS.
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG TRUE)
if(BUILD_TESTING)
# This is needed for the protobuf_generate_cpp() function to work on newer
# versions of the Protobuf CMake config.
set(protobuf_MODULE_COMPATIBLE ON CACHE BOOL "")

find_package(Protobuf)
# This is needed so that we pick up the (more modern) CONFIG mode cmake file
# before the (older) MODULE mode cmake config file. Seems to be needed on macOS.
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG TRUE)

find_package(Protobuf)
endif()

#-----------------------------------------------------------------------------
#
Expand Down

0 comments on commit d14dcae

Please sign in to comment.