diff --git a/CMakeLists.txt b/CMakeLists.txt index f07d574b..a3085102 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,10 +23,12 @@ include_directories(src) add_subdirectory(third_party) # Due to packaging changes we use the combined protobuf/absl packaging if -# available otherwise we fallback to the older protobuf method. -# TODO: Simplify once we can require cmake 3.27 (where CONFIG is default). +# available otherwise we fallback to the older protobuf method. TODO: Simplify +# once we can require cmake 3.27 (where CONFIG is default). find_package(Protobuf QUIET CONFIG) -if(NOT ${Protobuf_FOUND}) +if(${Protobuf_FOUND}) + set(PROTOBUF_LOADED_AS_CONFIG) +else() find_package(Protobuf REQUIRED) include_directories(${Protobuf_INCLUDE_DIRS}) endif() diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt index 6ace2da8..f1b01cc0 100644 --- a/third_party/CMakeLists.txt +++ b/third_party/CMakeLists.txt @@ -1,7 +1,9 @@ # SPDX-License-Identifier: Apache-2.0 -set(ABSL_PROPAGATE_CXX_STD ON) -add_subdirectory(abseil-cpp) +if(NOT ${PROTOBUF_LOADED_AS_CONFIG}) + set(ABSL_PROPAGATE_CXX_STD ON) + add_subdirectory(abseil-cpp) +endif() set(BUILD_TZ_LIB ON) add_subdirectory(datetime)