Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
marcalff committed Jul 11, 2024
1 parent eb2b975 commit 2d35432
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions ci/install_abseil.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,61 @@ if [ ! -z "${CXX_STANDARD}" ]; then
ABSEIL_CPP_BUILD_OPTIONS=(${ABSEIL_CPP_BUILD_OPTIONS[@]} "-DCMAKE_CXX_STANDARD=${CXX_STANDARD}")
fi

#
# ABSEIL_CPP_VERSION="20240116.1" fails to build with CMake 3.30
# ABSEIL_CPP_VERSION="20240116.2" fails to build with CMake 3.30
# note that somehow the same builds with CMake 3.29.6
#
# Error reported:
# CMake Error at CMake/AbseilHelpers.cmake:317 (target_link_libraries):
# The link interface of target "test_allocator" contains:
#
# GTest::gmock
#
# but the target was not found. Possible reasons include:
#
# * There is a typo in the target name.
# * A find_package call is missing for an IMPORTED target.
# * An ALIAS target is missing.
#
# Call Stack (most recent call first):
# absl/container/CMakeLists.txt:206 (absl_cc_library)
#
# Root cause:
# https://github.com/abseil/abseil-cpp/pull/1536
#
# Applying fix from abseil commit 779a3565ac6c5b69dd1ab9183e500a27633117d5
#
# TODO(marcalff) Cleanup once abseil is upgraded to the next LTS

echo "Patching abseil"

patch -p1 << EOF
commit 779a3565ac6c5b69dd1ab9183e500a27633117d5
Author: Derek Mauro <[email protected]>
Date: Tue Jan 30 10:13:25 2024 -0800
Avoid export of testonly target absl::test_allocator in CMake builds
Closes #1536
PiperOrigin-RevId: 602764437
Change-Id: Ia5c20a3874262a2ddb8797f608af17d7e86dd6d6
diff --git a/absl/container/CMakeLists.txt b/absl/container/CMakeLists.txt
index 449a2cad..ee9ca9c3 100644
--- a/absl/container/CMakeLists.txt
+++ b/absl/container/CMakeLists.txt
@@ -213,6 +213,7 @@ absl_cc_library(
DEPS
absl::config
GTest::gmock
+ TESTONLY
)
absl_cc_test(
EOF

mkdir build && pushd build
cmake "${ABSEIL_CPP_BUILD_OPTIONS[@]}" ..
make -j $(nproc)
Expand Down

0 comments on commit 2d35432

Please sign in to comment.