GCC 5 made several ABI changes for C++11 support, but they also kept
support for the older ABI. The macro _GLIBCXX_USE_CXX11_ABI can force
which mode you compile against.
Fedora 22 shipped with GCC 5 configured to use the old ABI by default,
as if -D_GLIBCXX_USE_CXX11_ABI=0, and Fedora 23 moved to the new ABI.
In either case you could make a different choice with that macro, but
any APIs you expose will be ABI-tagged, and programs you link with must
use the same choice. For working in a Linux distribution, it's usually
best to leave it at the default.
Commit dbd452640a57 forced the old ABI unconditionally. This patch adds
a cmake USE_CXX11_ABI setting, left blank to use the compiler default,
or set to a cmake boolean to force the new ABI on or off.
References:
http://developers.redhat.com/blog/2015/02/05/gcc5-and-the-c11-abi/
http://developers.redhat.com/blog/2015/02/10/gcc-5-in-fedora/
---
cmake/shared.cmake | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/cmake/shared.cmake b/cmake/shared.cmake
index 88b0b6aa86fe..699c5b489796 100644
--- a/cmake/shared.cmake
+++ b/cmake/shared.cmake
@@ -112,7 +112,14 @@ if(PLATFORM MATCHES nt OR PLATFORM MATCHES windows)
endif()
endif()
-add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0)
+set (USE_CXX11_ABI "" CACHE STRING "Override the default GNU C++11 ABI setting")
+if (NOT ("${USE_CXX11_ABI}" STREQUAL ""))
+ if (${USE_CXX11_ABI})
+ add_definitions(-D_GLIBCXX_USE_CXX11_ABI=1)
+ else()
+ add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0)
+ endif()
+endif()
#
# DyninstConfig.cmake