2014-02-05 08:02:37 +08:00
|
|
|
# This CMake module is responsible for setting the standard library to libc++
|
|
|
|
# if the user has requested it.
|
|
|
|
|
2015-09-29 22:33:58 +08:00
|
|
|
include(DetermineGCCCompatible)
|
|
|
|
|
2014-02-05 08:02:37 +08:00
|
|
|
if(NOT DEFINED LLVM_STDLIB_HANDLED)
|
|
|
|
set(LLVM_STDLIB_HANDLED ON)
|
|
|
|
|
2015-03-07 18:30:34 +08:00
|
|
|
function(append value)
|
|
|
|
foreach(variable ${ARGN})
|
|
|
|
set(${variable} "${${variable}} ${value}" PARENT_SCOPE)
|
|
|
|
endforeach(variable)
|
2014-02-05 08:02:37 +08:00
|
|
|
endfunction()
|
|
|
|
|
|
|
|
include(CheckCXXCompilerFlag)
|
|
|
|
if(LLVM_ENABLE_LIBCXX)
|
|
|
|
if(LLVM_COMPILER_IS_GCC_COMPATIBLE)
|
|
|
|
check_cxx_compiler_flag("-stdlib=libc++" CXX_SUPPORTS_STDLIB)
|
2015-03-07 18:30:34 +08:00
|
|
|
if(CXX_SUPPORTS_STDLIB)
|
|
|
|
append("-stdlib=libc++"
|
|
|
|
CMAKE_CXX_FLAGS CMAKE_EXE_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS
|
|
|
|
CMAKE_MODULE_LINKER_FLAGS)
|
|
|
|
else()
|
|
|
|
message(WARNING "Can't specify libc++ with '-stdlib='")
|
|
|
|
endif()
|
2014-02-05 08:02:37 +08:00
|
|
|
else()
|
|
|
|
message(WARNING "Not sure how to specify libc++ for this compiler")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
endif()
|