diff options
author | Vsevolod Stakhov <vsevolod@rspamd.com> | 2023-02-19 19:34:34 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rspamd.com> | 2023-02-19 19:34:34 +0000 |
commit | 01a20aa2ed551d0c8ae275caccb3046841aad62b (patch) | |
tree | 02d7a2f39fdfd91048218d8ecea91f4c6636719b | |
parent | 2f0d146b19db2d60b512855e8999dc2bcab22734 (diff) | |
download | rspamd-01a20aa2ed551d0c8ae275caccb3046841aad62b.tar.gz rspamd-01a20aa2ed551d0c8ae275caccb3046841aad62b.zip |
[Minor] Add autodetection of the libc++
-rw-r--r-- | cmake/Toolset.cmake | 17 | ||||
-rwxr-xr-x | debian/rules | 2 |
2 files changed, 17 insertions, 2 deletions
diff --git a/cmake/Toolset.cmake b/cmake/Toolset.cmake index cd372af13..fc019cf35 100644 --- a/cmake/Toolset.cmake +++ b/cmake/Toolset.cmake @@ -48,9 +48,24 @@ elseif (COMPILER_CLANG) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-command-line-argument") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-ignored-optimization-argument") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-ignored-optimization-argument") + if (ENABLE_LIBCXX MATCHES "AUTO") + include(CheckCXXSourceCompiles) + set(OLD_CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") + check_cxx_source_compiles(" +#include <version> +int main() { return 0; } + " HAVE_LIBCXX ) + if (HAVE_LIBCXX) + SET(ENABLE_LIBCXX "ON") + else() + SET(ENABLE_LIBCXX "OFF") + endif() + set(CMAKE_CXX_FLAGS "${OLD_CMAKE_CXX_FLAGS}") + endif() if (ENABLE_LIBCXX MATCHES "ON") - # Use libc++ as libstdc++ is buggy in many cases set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") + set(CLANG_DEFAULT_CXX_STDLIB "libc++") endif () else () message (WARNING "You are using an unsupported compiler ${CMAKE_C_COMPILER_ID}. Compilation has only been tested with Clang 4+ and GCC 4+.") diff --git a/debian/rules b/debian/rules index d12924d22..72823c3fc 100755 --- a/debian/rules +++ b/debian/rules @@ -54,7 +54,7 @@ configure_%: -DENABLE_LIBUNWIND=ON \ -DWANT_SYSTEMD_UNITS=ON \ -DENABLE_STATIC_LIBCXX=OFF \ - -DENABLE_LIBCXX=OFF \ + -DENABLE_LIBCXX=AUTO \ $(ENABLE_HYPERSCAN) \ $(ENABLE_LUAJIT) \ $(ENABLE_JEMALLOC) \ |