Introduce a cmake LLVM_ENABLE_LIBCXX build parameter to compile using libc++ instead of the system default

Summary:
This parameter is required to build C++11 projects (like lld or lldb) on OS X as the default STL does not provide c++ classes.


CC: llvm-commits, triton

Differential Revision: http://llvm-reviews.chandlerc.com/D2381

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198625 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Jean-Daniel Dupas 2014-01-06 18:27:27 +00:00
parent 34fa311267
commit 1abc3c0b7f
2 changed files with 8 additions and 0 deletions

View File

@ -182,6 +182,7 @@ else( MSVC )
endif()
option(LLVM_ENABLE_CXX11 "Compile with C++11 enabled." OFF)
option(LLVM_ENABLE_LIBCXX "Use libc++ if available." OFF)
option(LLVM_ENABLE_PEDANTIC "Compile with pedantic enabled." ON)
option(LLVM_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF)

View File

@ -253,6 +253,13 @@ elseif( LLVM_COMPILER_IS_GCC_COMPATIBLE )
check_cxx_compiler_flag("-std=c++11" CXX_SUPPORTS_CXX11)
append_if(CXX_SUPPORTS_CXX11 "-std=c++11" CMAKE_CXX_FLAGS)
endif (LLVM_ENABLE_CXX11)
if(LLVM_ENABLE_LIBCXX)
check_cxx_compiler_flag("-stdlib=libc++" CXX_SUPPORTS_STDLIB)
append_if(CXX_SUPPORTS_STDLIB "-stdlib=libc++" CMAKE_CXX_FLAGS)
append_if(CXX_SUPPORTS_STDLIB "-stdlib=libc++" CMAKE_EXE_LINKER_FLAGS)
append_if(CXX_SUPPORTS_STDLIB "-stdlib=libc++" CMAKE_SHARED_LINKER_FLAGS)
append_if(CXX_SUPPORTS_STDLIB "-stdlib=libc++" CMAKE_MODULE_LINKER_FLAGS)
endif ()
endif( MSVC )
macro(append_common_sanitizer_flags)