summaryrefslogtreecommitdiffstats
path: root/llvm/cmake/modules
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2015-03-07 10:30:34 +0000
committerChandler Carruth <chandlerc@gmail.com>2015-03-07 10:30:34 +0000
commitdc57c481af3628a2e07d3a8b8185997d8a1c2568 (patch)
treeb64b4d83117aeedacd016a843621d688991c1d12 /llvm/cmake/modules
parent7e7dd47fc21daf11c12484f4e9c4585b70d91560 (diff)
downloadbcm5719-llvm-dc57c481af3628a2e07d3a8b8185997d8a1c2568.tar.gz
bcm5719-llvm-dc57c481af3628a2e07d3a8b8185997d8a1c2568.zip
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. llvm-svn: 231560
Diffstat (limited to 'llvm/cmake/modules')
-rw-r--r--llvm/cmake/modules/HandleLLVMStdlib.cmake26
1 files changed, 16 insertions, 10 deletions
diff --git a/llvm/cmake/modules/HandleLLVMStdlib.cmake b/llvm/cmake/modules/HandleLLVMStdlib.cmake
index 47bb6cddc8e..66ad078fb66 100644
--- a/llvm/cmake/modules/HandleLLVMStdlib.cmake
+++ b/llvm/cmake/modules/HandleLLVMStdlib.cmake
@@ -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()
OpenPOWER on IntegriCloud