This is an automated email from the ASF dual-hosted git repository.

wangdan pushed a commit to branch v2.5
in repository https://gitbox.apache.org/repos/asf/incubator-pegasus.git


The following commit(s) were added to refs/heads/v2.5 by this push:
     new c9bf44969 fix(build): fix compilation error on MacOS for C++14 (#1648)
c9bf44969 is described below

commit c9bf4496929774c18a4beace4debb65dc9bd4213
Author: Dan Wang <[email protected]>
AuthorDate: Thu Oct 19 16:25:42 2023 +0800

    fix(build): fix compilation error on MacOS for C++14 (#1648)
    
    https://github.com/apache/incubator-pegasus/issues/1647
    
    The standard followed by 
[v2.5](https://github.com/apache/incubator-pegasus/tree/v2.5)
    would be C++14. However, Compilation on MacOS failed due to some errors, 
such as:
    - no member named 'make_unique' in namespace 'std'
    - initialized lambda captures are a C++14 extension
    - 'ext/alloc_traits.h' file not found
    
    Most of the errors are about C++14. `cmake` directives should be fixed to 
make C++14
    compilation on MacOS work well.
---
 cmake_modules/BaseFunctions.cmake | 3 ++-
 src/meta/meta_service.cpp         | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/cmake_modules/BaseFunctions.cmake 
b/cmake_modules/BaseFunctions.cmake
index bb9e0affc..8f55d5f77 100644
--- a/cmake_modules/BaseFunctions.cmake
+++ b/cmake_modules/BaseFunctions.cmake
@@ -147,6 +147,7 @@ function(dsn_add_project)
   endif()
   ms_add_project("${MY_PROJ_TYPE}" "${MY_PROJ_NAME}" "${MY_PROJ_SRC}" 
"${MY_PROJ_LIBS}" "${MY_BINPLACES}")
   define_file_basename_for_sources(${MY_PROJ_NAME})
+  target_compile_features(${MY_PROJ_NAME} PRIVATE cxx_std_14)
 endfunction(dsn_add_project)
 
 function(dsn_add_static_library)
@@ -204,7 +205,7 @@ function(dsn_setup_compiler_flags)
   # We want access to the PRI* print format macros.
   add_definitions(-D__STDC_FORMAT_MACROS)
 
-  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y -gdwarf-4" CACHE STRING 
"" FORCE)
+  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -gdwarf-4" CACHE STRING 
"" FORCE)
 
   #  -Wall: Enable all warnings.
   add_compile_options(-Wall)
diff --git a/src/meta/meta_service.cpp b/src/meta/meta_service.cpp
index 1aafc6189..5ea615c61 100644
--- a/src/meta/meta_service.cpp
+++ b/src/meta/meta_service.cpp
@@ -25,8 +25,8 @@
  */
 
 // IWYU pragma: no_include <boost/detail/basic_pointerbuf.hpp>
+// IWYU pragma: no_include <ext/alloc_traits.h>
 #include <boost/lexical_cast.hpp>
-#include <ext/alloc_traits.h>
 #include <algorithm> // for std::remove_if
 #include <chrono>
 #include <functional>


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to