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+.")