]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - opencl/llvm.git/commitdiff
Introduce a cmake LLVM_ENABLE_LIBCXX build parameter to compile using libc++ instead...
authorJean-Daniel Dupas <devlists@shadowlab.org>
Mon, 6 Jan 2014 18:27:27 +0000 (18:27 +0000)
committerJean-Daniel Dupas <devlists@shadowlab.org>
Mon, 6 Jan 2014 18:27:27 +0000 (18:27 +0000)
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

CMakeLists.txt
cmake/modules/HandleLLVMOptions.cmake

index 56e83289a45ad97618be92d24576b480c0d88712..ad31686aafc03096aa84f8e771c446c3684fd8b6 100644 (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)
 
index 38dacb7b88780a24e32b2586ba112b374f35f440..21d2cd67406f60d7acf48132c4734dd1b12e4957 100644 (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)