Update CMake configuration to add a dependency on Abseil (#9793)
* Proof of concept for CMake Abseil dependency * Hooked up Abseil linking * Adding test binaries * Reverting absl::string view use added for testing. This will still be broken for automake and bazel * Adding new cmake config to dist list * Whitespace fixes and an attempt at fix for Windows Python Release (CMake version < 3.13) * Hook up LTS to windows cmake * Fix 'git cd' typo * Adding clarifying comment for fix * Adding abseil dependency to protobuf-lite too * Update submodules instead of cloning abseil-cpp * Adding explicit pointer to abseil root directory Co-authored-by: Jason Lunn <jason.lunn@gmail.com> Co-authored-by: Jorg Brown <jorg.brown@gmail.com>pull/9800/head
parent
6f99f12a6b
commit
e9246cd789
16 changed files with 87 additions and 7 deletions
@ -1,4 +1,5 @@ |
||||
# These are fetched as external repositories. |
||||
third_party/abseil-cpp |
||||
third_party/benchmark |
||||
third_party/googletest |
||||
_build/ |
||||
|
@ -0,0 +1,28 @@ |
||||
if(protobuf_ABSL_PROVIDER STREQUAL "module") |
||||
if(NOT ABSL_ROOT_DIR) |
||||
set(ABSL_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third_party/abseil-cpp) |
||||
endif() |
||||
if(EXISTS "${ABSL_ROOT_DIR}/CMakeLists.txt") |
||||
if(protobuf_INSTALL) |
||||
# When protobuf_INSTALL is enabled and Abseil will be built as a module, |
||||
# Abseil will be installed along with protobuf for convenience. |
||||
set(ABSL_ENABLE_INSTALL ON) |
||||
endif() |
||||
add_subdirectory(${ABSL_ROOT_DIR} third_party/abseil-cpp) |
||||
else() |
||||
message(WARNING "protobuf_ABSL_PROVIDER is \"module\" but ABSL_ROOT_DIR is wrong") |
||||
endif() |
||||
if(protobuf_INSTALL AND NOT _protobuf_INSTALL_SUPPORTED_FROM_MODULE) |
||||
message(WARNING "protobuf_INSTALL will be forced to FALSE because protobuf_ABSL_PROVIDER is \"module\" and CMake version (${CMAKE_VERSION}) is less than 3.13.") |
||||
set(protobuf_INSTALL FALSE) |
||||
endif() |
||||
elseif(protobuf_ABSL_PROVIDER STREQUAL "package") |
||||
# Use "CONFIG" as there is no built-in cmake module for absl. |
||||
find_package(absl REQUIRED CONFIG) |
||||
endif() |
||||
set(_protobuf_FIND_ABSL "if(NOT TARGET absl::strings)\n find_package(absl CONFIG)\nendif()") |
||||
|
||||
set(protobuf_ABSL_USED_TARGETS |
||||
absl::strings |
||||
absl::strings_internal |
||||
) |
@ -0,0 +1 @@ |
||||
Subproject commit 8c6e53ef3adb1227fffa442c50349dab134a54bc |
Loading…
Reference in new issue