Force C++17 to unbreak build after abseil-cpp update

OK aja
This commit is contained in:
kn
2023-02-07 00:24:29 +00:00
parent d976b7d812
commit 967f5e96db
4 changed files with 55 additions and 0 deletions
+1
View File
@@ -2,6 +2,7 @@ COMMENT= unified backend for PIM programs
GNOME_PROJECT= evolution-data-server
GNOME_VERSION= 3.46.3
REVISION= 0
CATEGORIES= databases productivity
@@ -0,0 +1,14 @@
Crank to C++17 to match libphonenumber and abseil-cpp.
Index: CMakeLists.txt
--- CMakeLists.txt.orig
+++ CMakeLists.txt
@@ -6,7 +6,7 @@ cmake_policy(VERSION 3.1)
project(evolution-data-server
VERSION 3.46.3
LANGUAGES C CXX)
-set(CMAKE_CXX_STANDARD 14)
+set(CMAKE_CXX_STANDARD 17)
set(PROJECT_BUGREPORT "https://gitlab.gnome.org/GNOME/evolution-data-server/issues/")
# Base Version: This is for API/version tracking for things like
@@ -0,0 +1,25 @@
abseil-cpp>=20230115.0 used by libphonenumber fails unless C++17 is used,
but CMAKE_CXX_STANDARD has no effect on CheckCXXSourceCompiles().
CMAKE_REQUIRED_FLAGS must not be passed globally as it effects all targets,
including C files.
Index: cmake/modules/FindPhonenumber.cmake
--- cmake/modules/FindPhonenumber.cmake.orig
+++ cmake/modules/FindPhonenumber.cmake
@@ -53,6 +53,7 @@ unset(optupper)
set(CMAKE_REQUIRED_DEFINITIONS ${PHONENUMBER_DEFINITIONS})
set(CMAKE_REQUIRED_INCLUDES ${PHONENUMBER_INCLUDE_DIRS})
+set(CMAKE_REQUIRED_FLAGS "-std=gnu++${CMAKE_CXX_STANDARD}")
foreach(lib boost_thread-mt boost_thread)
set(CMAKE_REQUIRED_LIBRARIES ${PHONENUMBER_LDFLAGS} -l${lib})
CHECK_CXX_SOURCE_COMPILES("#include <phonenumbers/phonenumberutil.h>
@@ -67,6 +68,7 @@ foreach(lib boost_thread-mt boost_thread)
break()
endif(phone_number_with_${lib})
endforeach(lib)
+unset(CMAKE_REQUIRED_FLAGS)
if(NOT ENABLE_PHONENUMBER)
message(FATAL_ERROR "libphonenumber cannot be used. Use -DWITH_PHONENUMBER=PATH to specify the library prefix, or -DWITH_PHONENUMBER=OFF to disable it.")
@@ -0,0 +1,15 @@
Replace auto_ptr (deprecated/removed in C++11/17) with unique_ptr to build with
C++17 as required by abseil-cpp (through libphonenumber).
Index: src/addressbook/libebook-contacts/e-phone-number-private.cpp
--- src/addressbook/libebook-contacts/e-phone-number-private.cpp.orig
+++ src/addressbook/libebook-contacts/e-phone-number-private.cpp
@@ -183,7 +183,7 @@ _e_phone_number_cxx_from_string (const gchar *phone_nu
g_return_val_if_fail (NULL != phone_number, NULL);
const std::string valid_region = _e_phone_number_cxx_make_region_code (region_code);
- std::auto_ptr<EPhoneNumber> parsed_number(new EPhoneNumber);
+ std::unique_ptr<EPhoneNumber> parsed_number(new EPhoneNumber);
if (!_e_phone_number_cxx_parse (
phone_number, valid_region, &parsed_number->priv, error))