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.
Details
- Reviewers
- None
- Commits
- rL198625: Introduce a cmake LLVM_ENABLE_LIBCXX build parameter to compile using libc++…
Diff Detail
Event Timeline
Introduce a cmake LLVM_ENABLE_LIBCXX build parameter to compile using libc++ instead of the system default.
ping
Le 11 déc. 2013 à 14:58, Jean-Daniel Dupas <devlists@shadowlab.org> a écrit :
Introduce a cmake LLVM_ENABLE_LIBCXX build parameter to compile using libc++ instead of the system default.
http://llvm-reviews.chandlerc.com/D2381
CHANGE SINCE LAST DIFF
http://llvm-reviews.chandlerc.com/D2381?vs=6021&id=6022#tocFiles:
CMakeLists.txt
cmake/modules/HandleLLVMOptions.cmakeIndex: CMakeLists.txt
- CMakeLists.txt
+++ CMakeLists.txt
@@ -180,6 +180,7 @@
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)Index: cmake/modules/HandleLLVMOptions.cmake
- cmake/modules/HandleLLVMOptions.cmake
+++ cmake/modules/HandleLLVMOptions.cmake
@@ -250,6 +250,13 @@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)
<D2381.2.patch>
- Jean-Daniel
LGTM.
I've tested the patch and was able to complete a C++11 LLVM build with CMake on OSX.