2021-11-21 10:58:26 +00:00
|
|
|
option (USE_LIBCXX "Use libc++ and libc++abi instead of libstdc++" ON)
|
2020-08-14 15:44:04 +00:00
|
|
|
|
2020-09-18 14:18:59 +00:00
|
|
|
if (NOT USE_LIBCXX)
|
2020-08-14 15:44:04 +00:00
|
|
|
target_link_libraries(global-libs INTERFACE -l:libstdc++.a -l:libstdc++fs.a) # Always link these libraries as static
|
|
|
|
target_link_libraries(global-libs INTERFACE ${EXCEPTION_HANDLING_LIBRARY})
|
|
|
|
return()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_LIBCPP_DEBUG=0") # More checks in debug build.
|
|
|
|
|
|
|
|
if (NOT HAVE_LIBCXX AND NOT MISSING_INTERNAL_LIBCXX_LIBRARY)
|
|
|
|
set (LIBCXX_LIBRARY cxx)
|
|
|
|
set (LIBCXXABI_LIBRARY cxxabi)
|
|
|
|
add_subdirectory(contrib/libcxxabi-cmake)
|
|
|
|
add_subdirectory(contrib/libcxx-cmake)
|
2019-08-28 20:49:37 +00:00
|
|
|
|
2020-08-14 15:44:04 +00:00
|
|
|
# Exception handling library is embedded into libcxxabi.
|
2019-08-28 20:49:37 +00:00
|
|
|
|
|
|
|
set (HAVE_LIBCXX 1)
|
2020-08-14 15:44:04 +00:00
|
|
|
endif ()
|
|
|
|
|
|
|
|
if (HAVE_LIBCXX)
|
|
|
|
target_link_libraries(global-libs INTERFACE ${LIBCXX_LIBRARY} ${LIBCXXABI_LIBRARY} ${LIBCXXFS_LIBRARY})
|
2019-08-28 20:49:37 +00:00
|
|
|
|
|
|
|
message (STATUS "Using libcxx: ${LIBCXX_LIBRARY}")
|
|
|
|
message (STATUS "Using libcxxfs: ${LIBCXXFS_LIBRARY}")
|
|
|
|
message (STATUS "Using libcxxabi: ${LIBCXXABI_LIBRARY}")
|
2020-08-14 15:44:04 +00:00
|
|
|
else()
|
2019-08-28 20:49:37 +00:00
|
|
|
target_link_libraries(global-libs INTERFACE -l:libstdc++.a -l:libstdc++fs.a) # Always link these libraries as static
|
|
|
|
target_link_libraries(global-libs INTERFACE ${EXCEPTION_HANDLING_LIBRARY})
|
2020-08-14 15:44:04 +00:00
|
|
|
endif()
|