[llvm] r198625 - Introduce a cmake LLVM_ENABLE_LIBCXX build parameter to compile using libc++ instead of the system default

Jean-Daniel Dupas devlists at shadowlab.org
Mon Jan 6 10:27:27 PST 2014


Author: jddupas
Date: Mon Jan  6 12:27:27 2014
New Revision: 198625

URL: http://llvm.org/viewvc/llvm-project?rev=198625&view=rev
Log:
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

Modified:
    llvm/trunk/CMakeLists.txt
    llvm/trunk/cmake/modules/HandleLLVMOptions.cmake

Modified: llvm/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/CMakeLists.txt?rev=198625&r1=198624&r2=198625&view=diff
==============================================================================
--- llvm/trunk/CMakeLists.txt (original)
+++ llvm/trunk/CMakeLists.txt Mon Jan  6 12:27:27 2014
@@ -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)
 

Modified: llvm/trunk/cmake/modules/HandleLLVMOptions.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/HandleLLVMOptions.cmake?rev=198625&r1=198624&r2=198625&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/HandleLLVMOptions.cmake (original)
+++ llvm/trunk/cmake/modules/HandleLLVMOptions.cmake Mon Jan  6 12:27:27 2014
@@ -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)





More information about the llvm-commits mailing list