[llvm] r231560 - Teach the LLVM CMake build how to explicitly use libc++abi when using
Chandler Carruth
chandlerc at gmail.com
Sat Mar 7 02:30:35 PST 2015
Author: chandlerc
Date: Sat Mar 7 04:30:34 2015
New Revision: 231560
URL: http://llvm.org/viewvc/llvm-project?rev=231560&view=rev
Log:
Teach the LLVM CMake build how to explicitly use libc++abi when using
libc++. This lets me almost self-host on Linux with libc++ and libc++abi
very simply.
Currently, MCJIT and OrcJIT are failing due to uncaught exceptions, and
the Go binding tests are failing to build due to not linking in the
correct C++ standard library.
Modified:
llvm/trunk/CMakeLists.txt
llvm/trunk/cmake/modules/HandleLLVMStdlib.cmake
Modified: llvm/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/CMakeLists.txt?rev=231560&r1=231559&r2=231560&view=diff
==============================================================================
--- llvm/trunk/CMakeLists.txt (original)
+++ llvm/trunk/CMakeLists.txt Sat Mar 7 04:30:34 2015
@@ -252,6 +252,7 @@ endif()
option(LLVM_ENABLE_MODULES "Compile with C++ modules enabled." OFF)
option(LLVM_ENABLE_CXX1Y "Compile with C++1y enabled." OFF)
option(LLVM_ENABLE_LIBCXX "Use libc++ if available." OFF)
+option(LLVM_ENABLE_LIBCXXABI "Use libc++abi when using libc++." 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/HandleLLVMStdlib.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/HandleLLVMStdlib.cmake?rev=231560&r1=231559&r2=231560&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/HandleLLVMStdlib.cmake (original)
+++ llvm/trunk/cmake/modules/HandleLLVMStdlib.cmake Sat Mar 7 04:30:34 2015
@@ -12,22 +12,28 @@ if(NOT DEFINED LLVM_STDLIB_HANDLED)
set(LLVM_COMPILER_IS_GCC_COMPATIBLE ON)
endif()
- function(append_if condition value)
- if(${condition})
- foreach(variable ${ARGN})
- set(${variable} "${${variable}} ${value}" PARENT_SCOPE)
- endforeach(variable)
- endif()
+ function(append value)
+ foreach(variable ${ARGN})
+ set(${variable} "${${variable}} ${value}" PARENT_SCOPE)
+ endforeach(variable)
endfunction()
include(CheckCXXCompilerFlag)
if(LLVM_ENABLE_LIBCXX)
if(LLVM_COMPILER_IS_GCC_COMPATIBLE)
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)
+ if(CXX_SUPPORTS_STDLIB)
+ append("-stdlib=libc++"
+ CMAKE_CXX_FLAGS CMAKE_EXE_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS
+ CMAKE_MODULE_LINKER_FLAGS)
+ if(LLVM_ENABLE_LIBCXXABI)
+ append("-lc++abi"
+ CMAKE_EXE_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS
+ CMAKE_MODULE_LINKER_FLAGS)
+ endif()
+ else()
+ message(WARNING "Can't specify libc++ with '-stdlib='")
+ endif()
else()
message(WARNING "Not sure how to specify libc++ for this compiler")
endif()
More information about the llvm-commits
mailing list