Skip to content

Commit c9bf449

Browse files
authored
fix(build): fix compilation error on MacOS for C++14 (apache#1648)
apache#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.
1 parent ca40393 commit c9bf449

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

cmake_modules/BaseFunctions.cmake

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ function(dsn_add_project)
147147
endif()
148148
ms_add_project("${MY_PROJ_TYPE}" "${MY_PROJ_NAME}" "${MY_PROJ_SRC}" "${MY_PROJ_LIBS}" "${MY_BINPLACES}")
149149
define_file_basename_for_sources(${MY_PROJ_NAME})
150+
target_compile_features(${MY_PROJ_NAME} PRIVATE cxx_std_14)
150151
endfunction(dsn_add_project)
151152

152153
function(dsn_add_static_library)
@@ -204,7 +205,7 @@ function(dsn_setup_compiler_flags)
204205
# We want access to the PRI* print format macros.
205206
add_definitions(-D__STDC_FORMAT_MACROS)
206207

207-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y -gdwarf-4" CACHE STRING "" FORCE)
208+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -gdwarf-4" CACHE STRING "" FORCE)
208209

209210
# -Wall: Enable all warnings.
210211
add_compile_options(-Wall)

src/meta/meta_service.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
*/
2626

2727
// IWYU pragma: no_include <boost/detail/basic_pointerbuf.hpp>
28+
// IWYU pragma: no_include <ext/alloc_traits.h>
2829
#include <boost/lexical_cast.hpp>
29-
#include <ext/alloc_traits.h>
3030
#include <algorithm> // for std::remove_if
3131
#include <chrono>
3232
#include <functional>

0 commit comments

Comments
 (0)