Update CMakeLists.txt to support OSX + Clang

This commit is contained in:
Soonho Kong 2013-08-12 10:32:07 -07:00
parent 6cb46d9de7
commit 2b6d8a4d01

View file

@ -32,7 +32,14 @@ if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
message(FATAL_ERROR "${PROJECT_NAME} requires g++ 4.8 or greater.")
endif ()
elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
# Do nothing
IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
# In OSX, clang requires "-stdlib=libc++" to support C++11
IF(EXISTS "/usr/local/Cellar/libcxx/3.3/lib/c++/v1")
include_directories(/usr/local/Cellar/libcxx/3.3/lib/c++/v1)
ENDIF()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
set(LEAN_EXTRA_LINKER_FLAGS "-stdlib=libc++")
ENDIF ()
else ()
message(FATAL_ERROR "Your C++ compiler does not support C++11.")
endif ()