From a34fb4018cb90f3227bde008ff690f84b4602ed8 Mon Sep 17 00:00:00 2001 From: Christopher Hong Date: Wed, 17 Jan 2024 19:32:48 -0500 Subject: [PATCH 1/2] Add idempotency to external absl mod --- CMakeLists.txt | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3a989bf6..9fa37fa8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -163,16 +163,20 @@ elseif (SPM_ABSL_PROVIDER STREQUAL "module") SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third_party/abseil-cpp GIT_PROGRESS TRUE) add_subdirectory(third_party/abseil-cpp) - file(RENAME ${CMAKE_CURRENT_SOURCE_DIR}/third_party/absl ${CMAKE_CURRENT_SOURCE_DIR}/third_party/absl.org) - execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink - ${CMAKE_CURRENT_SOURCE_DIR}/third_party/abseil-cpp/absl - ${CMAKE_CURRENT_SOURCE_DIR}/third_party/absl) + if (NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/third_party/absl.org) + file(RENAME ${CMAKE_CURRENT_SOURCE_DIR}/third_party/absl ${CMAKE_CURRENT_SOURCE_DIR}/third_party/absl.org) + execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink + ${CMAKE_CURRENT_SOURCE_DIR}/third_party/abseil-cpp/absl + ${CMAKE_CURRENT_SOURCE_DIR}/third_party/absl) + endif() elseif (SPM_ABSL_PROVIDER STREQUAL "package") find_package(absl REQUIRED) get_target_property(ABSL_INCLUDE_DIRS absl::base INTERFACE_INCLUDE_DIRECTORIES) - file(RENAME ${CMAKE_CURRENT_SOURCE_DIR}/third_party/absl ${CMAKE_CURRENT_SOURCE_DIR}/third_party/absl.org) - execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink - ${ABSL_INCLUDE_DIRS}/absl ${CMAKE_CURRENT_SOURCE_DIR}/third_party/absl) + if (NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/third_party/absl.org) + file(RENAME ${CMAKE_CURRENT_SOURCE_DIR}/third_party/absl ${CMAKE_CURRENT_SOURCE_DIR}/third_party/absl.org) + execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink + ${ABSL_INCLUDE_DIRS}/absl ${CMAKE_CURRENT_SOURCE_DIR}/third_party/absl) + endif() include_directories(${ABSL_INCLUDE_DIRS}) endif() From 0ea22c03e262a41de522c344f3abb08cc3e1452c Mon Sep 17 00:00:00 2001 From: Christopher Hong Date: Wed, 17 Jan 2024 19:33:51 -0500 Subject: [PATCH 2/2] Fix build for external absl --- src/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index beb7aa57..8d4a34f4 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -18,6 +18,8 @@ if (SPM_ABSL_PROVIDER STREQUAL "module" OR SPM_ABSL_PROVIDER STREQUAL "package") list(APPEND SPM_LIBS absl::strings) list(APPEND SPM_LIBS absl::flags) list(APPEND SPM_LIBS absl::flags_parse) + list(APPEND SPM_LIBS absl::log) + list(APPEND SPM_LIBS absl::check) if (MSVC) add_definitions("/D_USE_EXTERNAL_ABSL") else()