File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -187,6 +187,10 @@ ifneq (${USE_LIBCPLUSPLUS},)
187187MY_CMAKE_FLAGS += -DUSE_LIBCPLUSPLUS:BOOL=${USE_LIBCPLUSPLUS}
188188endif
189189
190+ ifneq (${GLIBCXX_USE_CXX11_ABI},)
191+ MY_CMAKE_FLAGS += -DGLIBCXX_USE_CXX11_ABI=${GLIBCXX_USE_CXX11_ABI}
192+ endif
193+
190194ifneq (${EXTRA_CPP_ARGS},)
191195MY_CMAKE_FLAGS += -DEXTRA_CPP_ARGS:STRING="${EXTRA_CPP_ARGS}"
192196endif
@@ -373,6 +377,7 @@ help:
373377 @echo " MYCC=xx MYCXX=yy Use custom compilers"
374378 @echo " USE_CPP=14 Compile in C++14 mode (default is C++11)"
375379 @echo " USE_LIBCPLUSPLUS=1 Use clang libc++"
380+ @echo " GLIBCXX_USE_CXX11_ABI=1 For gcc, use the new string ABI"
376381 @echo " EXTRA_CPP_ARGS= Additional args to the C++ command"
377382 @echo " USE_NINJA=1 Set up Ninja build (instead of make)"
378383 @echo " USE_CCACHE=0 Disable ccache (even if available)"
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ option (CLANG_TIDY "Enable clang-tidy" OFF)
2121set (CLANG_TIDY_CHECKS "-*" CACHE STRING "clang-tidy checks to perform" )
2222set (CLANG_TIDY_ARGS "" CACHE STRING "clang-tidy args" )
2323option (CLANG_TIDY_FIX "Have clang-tidy fix source" OFF )
24+ set (GLIBCXX_USE_CXX11_ABI "" CACHE STRING "For gcc, use the new C++11 library ABI (0|1)" )
2425
2526
2627# Figure out which compiler we're using
@@ -196,6 +197,18 @@ if (USE_LIBCPLUSPLUS AND CMAKE_COMPILER_IS_CLANG)
196197 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++" )
197198endif ()
198199
200+ # GCC 5+: honor build-time option for whether or not to use new string ABI.
201+ # FIXME: In theory, this should also be needed for clang, if compiling with
202+ # the gcc libstdc++ toolchain. In practice, I could not get things to build
203+ # with clang properly when using this option, and I haven't yet seen a case
204+ # where it's needed. We can return to this and fix for clang if it becomes a
205+ # legit problem later.
206+ if (CMAKE_COMPILER_IS_GNUCC AND NOT ${GCC_VERSION} VERSION_LESS 5.0)
207+ if (NOT ${GLIBCXX_USE_CXX11_ABI} STREQUAL "" )
208+ add_definitions ("-D_GLIBCXX_USE_CXX11_ABI=${GLIBCXX_USE_CXX11_ABI} " )
209+ endif ()
210+ endif ()
211+
199212
200213# SIMD and machine architecture options
201214set (SIMD_COMPILE_FLAGS "" )
You can’t perform that action at this time.
0 commit comments