ports/devel/libphonenumber/files/patch-tools_CMakeLists.txt
Adriaan de Groot 652e447482 devel/libphonenumber: update to 8.12.41, latest upstream
This update introduces new tools, which use abseil. The build
system tries to git-clone the abseil repo and build that.
Instead, use devel/abseil. However, devel/abseil is built as
C++17, so we need to patch the build to force C++17 on
libphonenumber as well (otherwise, abseil introduces pre-C++17
versions of string_view and link failures follow).

We set WRKSRC_SUBDIR, but the build system now *also*
goes off to ../tools/cpp (from that SUBDIR), so .. I suppose
we could drop the SUBDIR setting and instead try some other
way of invoking CMake for only the C++ parts. Rather than doing
that, keep SUBDIR, but that gives us a patch with path ../tools/
which deservers mention. Consider it mentioned.
2022-01-22 22:42:05 +01:00

47 lines
1.4 KiB
Text

This patch applies from WRKSRC_SUBDIR, ie. from cpp/ , but even
when building in that subdir, the tools/ directory is built
as well. That is why the patch applies to ..
- use system abseil instead of fetching it on our own.
- force C++17 because abseil has it, too.
--- ../tools/cpp/CMakeLists.txt.orig 2022-01-11 10:41:37.000000000 +0100
+++ ../tools/cpp/CMakeLists.txt 2022-01-22 17:06:39.284013000 +0100
@@ -18,7 +18,7 @@
# Pick the C++ standard to compile with.
# Abseil currently supports C++11, C++14, and C++17.
-set(CMAKE_CXX_STANDARD 11)
+set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
project (generate_geocoding_data)
@@ -28,27 +28,11 @@
include (gtest.cmake)
include (FetchContent)
-# Downloading the abseil sources.
-FetchContent_Declare(
- abseil-cpp
- GIT_REPOSITORY https://github.com/abseil/abseil-cpp.git
- GIT_TAG origin/master
-)
+find_package(absl REQUIRED)
-# Building the abseil binaries
-FetchContent_GetProperties(abseil-cpp)
-if (NOT abseil-cpp_POPULATED)
- FetchContent_Populate(abseil-cpp)
-endif ()
-
-if (NOT abseil-cpp_POPULATED)
- message (FATAL_ERROR "Could not build abseil-cpp binaries.")
-endif ()
-
# Safeguarding against any potential link errors as mentioned in
# https://github.com/abseil/abseil-cpp/issues/225
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
-add_subdirectory(${abseil-cpp_SOURCE_DIR} ${abseil-cpp_BINARY_DIR})
find_or_build_gtest ()
set (