@@ -34,6 +34,8 @@ endif()
3434
3535set (IOTDB_EXTRA_CXX_FLAGS ""
3636 CACHE STRING "Extra flags appended to CMAKE_CXX_FLAGS" )
37+ set (IOTDB_USE_CXX11_ABI ""
38+ CACHE STRING "Set _GLIBCXX_USE_CXX11_ABI for GNU libstdc++ builds (empty keeps toolchain default)" )
3739
3840if (NOT MSVC )
3941 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS } -Wall -g -O2" )
@@ -47,6 +49,10 @@ if(MSVC)
4749 set (CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG :Debug >:Debug >DLL" )
4850endif ()
4951
52+ if (IOTDB_USE_CXX11_ABI AND NOT IOTDB_USE_CXX11_ABI MATCHES "^[01]$" )
53+ message (FATAL_ERROR "IOTDB_USE_CXX11_ABI must be empty, 0, or 1" )
54+ endif ()
55+
5056option (WITH_SSL "Build with OpenSSL support" OFF )
5157option (BUILD_TESTING "Build IT test executables" OFF )
5258option (IOTDB_OFFLINE "Disable all network access during configure" OFF )
@@ -116,6 +122,10 @@ endif()
116122add_dependencies (iotdb_session iotdb_thrift_external iotdb_thrift_codegen )
117123
118124target_compile_definitions (iotdb_session PRIVATE THRIFT_STATIC_DEFINE IOTDB_BUILDING_SHARED )
125+ if (IOTDB_USE_CXX11_ABI AND NOT MSVC )
126+ target_compile_definitions (iotdb_session PUBLIC
127+ _GLIBCXX_USE_CXX11_ABI=${IOTDB_USE_CXX11_ABI} )
128+ endif ()
119129
120130target_include_directories (iotdb_session
121131 PUBLIC
@@ -186,9 +196,16 @@ foreach(_hdr IN LISTS IOTDB_PUBLIC_HEADERS)
186196endforeach ()
187197
188198set (IOTDB_SESSION_PC_LIBS "-liotdb_session" )
199+ set (IOTDB_SESSION_PC_CFLAGS "" )
200+ set (IOTDB_SESSION_CXX11_ABI_COMPILE_DEFINITION "" )
189201if (UNIX )
190202 set (IOTDB_SESSION_PC_LIBS "${IOTDB_SESSION_PC_LIBS} -pthread" )
191203endif ()
204+ if (IOTDB_USE_CXX11_ABI AND NOT MSVC )
205+ set (IOTDB_SESSION_PC_CFLAGS "-D_GLIBCXX_USE_CXX11_ABI=${IOTDB_USE_CXX11_ABI} " )
206+ set (IOTDB_SESSION_CXX11_ABI_COMPILE_DEFINITION
207+ "_GLIBCXX_USE_CXX11_ABI=${IOTDB_USE_CXX11_ABI} " )
208+ endif ()
192209configure_file (
193210 "${CMAKE_CURRENT_SOURCE_DIR } /cmake/iotdb-session-config.cmake.in"
194211 "${CMAKE_BINARY_DIR } /package-metadata/cmake/iotdb-session-config.cmake"
@@ -224,6 +241,7 @@ file(WRITE "${CMAKE_BINARY_DIR}/package-metadata/BUILD-INFO.txt"
224241 "cmake.build.type=${CMAKE_BUILD_TYPE } \n "
225242 "with.ssl=${WITH_SSL} \n "
226243 "iotdb.offline=${IOTDB_OFFLINE} \n "
244+ "iotdb.use.cxx11.abi=${IOTDB_USE_CXX11_ABI} \n "
227245 "iotdb.extra.cxx.flags=${IOTDB_EXTRA_CXX_FLAGS} \n " )
228246install (FILES "${CMAKE_BINARY_DIR } /package-metadata/cmake/iotdb-session-config.cmake"
229247 DESTINATION cmake)
@@ -245,6 +263,7 @@ message(STATUS "iotdb_session configuration summary:")
245263message (STATUS " WITH_SSL = ${WITH_SSL} " )
246264message (STATUS " BUILD_TESTING = ${BUILD_TESTING} " )
247265message (STATUS " IOTDB_OFFLINE = ${IOTDB_OFFLINE} " )
266+ message (STATUS " IOTDB_USE_CXX11_ABI = ${IOTDB_USE_CXX11_ABI} " )
248267message (STATUS " IOTDB_DEPS_DIR = ${IOTDB_DEPS_DIR} " )
249268message (STATUS " BOOST_INCLUDE_DIR = ${BOOST_INCLUDE_DIR} (Thrift build only)" )
250269message (STATUS " THRIFT_INCLUDE_DIR = ${THRIFT_INCLUDE_DIR} " )
0 commit comments