diff --git a/CMakeLists.txt b/CMakeLists.txt index 9127cd0d..42ad3892 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,12 +22,14 @@ include_directories(src) add_subdirectory(third_party) +# TODO: Simplify once we can require cmake 3.27 (where CONFIG is default). + # 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. find_package(Protobuf QUIET CONFIG) -set(ABSL_INCLUDED_WITH_PROTOBUF ON) -if(NOT ${Protobuf_FOUND}) +if(${Protobuf_FOUND}) + set(ABSL_INCLUDED_WITH_PROTOBUF ON) +else() find_package(Protobuf REQUIRED) include_directories(${Protobuf_INCLUDE_DIRS}) set(ABSL_INCLUDED_WITH_PROTOBUF OFF) diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt index 7b8d8e60..dfb1bc02 100644 --- a/third_party/CMakeLists.txt +++ b/third_party/CMakeLists.txt @@ -1,6 +1,8 @@ # SPDX-License-Identifier: Apache-2.0 -if(NOT ${ABSL_INCLUDED_WITH_PROTOBUF}) +if(${ABSL_INCLUDED_WITH_PROTOBUF}) + # Remove abseil-cpp from the repo when we can require cmake 3.27. +else() set(ABSL_PROPAGATE_CXX_STD ON) add_subdirectory(abseil-cpp) endif()