summaryrefslogtreecommitdiff
path: root/clang-r353983e/lib64/cmake/llvm/HandleLLVMStdlib.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'clang-r353983e/lib64/cmake/llvm/HandleLLVMStdlib.cmake')
-rw-r--r--clang-r353983e/lib64/cmake/llvm/HandleLLVMStdlib.cmake32
1 files changed, 32 insertions, 0 deletions
diff --git a/clang-r353983e/lib64/cmake/llvm/HandleLLVMStdlib.cmake b/clang-r353983e/lib64/cmake/llvm/HandleLLVMStdlib.cmake
new file mode 100644
index 00000000..a0706d8e
--- /dev/null
+++ b/clang-r353983e/lib64/cmake/llvm/HandleLLVMStdlib.cmake
@@ -0,0 +1,32 @@
+# This CMake module is responsible for setting the standard library to libc++
+# if the user has requested it.
+
+include(DetermineGCCCompatible)
+
+if(NOT DEFINED LLVM_STDLIB_HANDLED)
+ set(LLVM_STDLIB_HANDLED ON)
+
+ function(append value)
+ foreach(variable ${ARGN})
+ set(${variable} "${${variable}} ${value}" PARENT_SCOPE)
+ endforeach(variable)
+ endfunction()
+
+ include(CheckCXXCompilerFlag)
+ include(CheckLinkerFlag)
+ if(LLVM_ENABLE_LIBCXX)
+ if(LLVM_COMPILER_IS_GCC_COMPATIBLE)
+ check_cxx_compiler_flag("-stdlib=libc++" CXX_COMPILER_SUPPORTS_STDLIB)
+ check_linker_flag("-stdlib=libc++" CXX_LINKER_SUPPORTS_STDLIB)
+ if(CXX_COMPILER_SUPPORTS_STDLIB AND CXX_LINKER_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()
+ else()
+ message(WARNING "Not sure how to specify libc++ for this compiler")
+ endif()
+ endif()
+endif()