commit 72bf74c: [Minor] Allow to enable libc++ conditionally

Vsevolod Stakhov vsevolod at highsecure.ru
Tue Feb 9 16:49:07 UTC 2021


Author: Vsevolod Stakhov
Date: 2021-02-09 16:41:55 +0000
URL: https://github.com/rspamd/rspamd/commit/72bf74c6da39f568f0b3c42e34204bbd1493d5ad

[Minor] Allow to enable libc++ conditionally

---
 cmake/Toolset.cmake | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/cmake/Toolset.cmake b/cmake/Toolset.cmake
index 5a4faebf2..6ba290f96 100644
--- a/cmake/Toolset.cmake
+++ b/cmake/Toolset.cmake
@@ -2,6 +2,7 @@ option (ENABLE_FAST_MATH     "Build rspamd with fast math compiler flag [default
 option (ENABLE_ANALYZER      "Build rspamd with static analyzer [default: OFF]" OFF)
 option (ENABLE_STATIC_LIBCXX "Build rspamd with static lib(std)c++ [default: OFF]" OFF)
 option (ENABLE_COMPILE_TIME  "Show compile time [default: OFF]" OFF)
+option (ENABLE_LIBCXX        "Use libc++ instead of libstdc++" OFF)
 
 if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
     SET (COMPILER_GCC 1)
@@ -31,6 +32,9 @@ if (COMPILER_GCC)
     if (CMAKE_C_COMPILER_VERSION VERSION_LESS ${GCC_MINIMUM_VERSION} AND NOT CMAKE_VERSION VERSION_LESS 2.8.9)
         message (FATAL_ERROR "GCC version must be at least ${GCC_MINIMUM_VERSION}.")
     endif ()
+    if (ENABLE_LIBCXX MATCHES "ON")
+        # XXX: too complicated to implement for now
+    endif ()
 elseif (COMPILER_CLANG)
     # Require minimum version of clang
     set (CLANG_MINIMUM_VERSION 7)
@@ -38,8 +42,10 @@ elseif (COMPILER_CLANG)
         message (FATAL_ERROR "Clang version must be at least ${CLANG_MINIMUM_VERSION}.")
     endif ()
     ADD_COMPILE_OPTIONS(-Wno-unused-command-line-argument)
-    # Use libc++ as libstdc++ is buggy in many cases
-    set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
+    if (ENABLE_LIBCXX MATCHES "ON")
+        # Use libc++ as libstdc++ is buggy in many cases
+        set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -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+.")
 endif ()


More information about the Commits mailing list