From 4fccc4399fbdeff42149d2059d9c20246cd0457a Mon Sep 17 00:00:00 2001 From: root Date: Fri, 13 Feb 2015 15:56:26 +0800 Subject: [PATCH] Try supporting clang, doesn't work yet --- CMakeLists.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0edb761f..32a03adc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,6 +25,12 @@ include(CheckCXXCompilerFlag) check_cxx_compiler_flag(-std=c++11 HAVE_STD_CPP11_FLAG) if (HAVE_STD_CPP11_FLAG) set(CPP11_FLAG -std=c++11) + # Use libc++. + # We may link with libc++abi as well, leave it for now + if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") + message(STATUS "${CMAKE_CXX_COMPILER_ID} detected! Use libc++ as its standard library.") + set(CPP11_FLAG "-std=c++11 -stdlib=libc++ -lc++") + endif () else () check_cxx_compiler_flag(-std=c++0x HAVE_STD_CPP0X_FLAG) if (HAVE_STD_CPP0X_FLAG) @@ -74,7 +80,7 @@ if (BIICODE) endif () add_library(format ${FMT_SOURCES}) -if (CMAKE_COMPILER_IS_GNUCXX) +if (CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") set_target_properties(format PROPERTIES COMPILE_FLAGS "-Wall -Wextra -Wshadow -pedantic") if (CPP11_FLAG)