diff options
Diffstat (limited to 'llvm/cmake')
| -rw-r--r-- | llvm/cmake/modules/HandleLLVMStdlib.cmake | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/llvm/cmake/modules/HandleLLVMStdlib.cmake b/llvm/cmake/modules/HandleLLVMStdlib.cmake index f0e22d1a5b3..b67d87d4300 100644 --- a/llvm/cmake/modules/HandleLLVMStdlib.cmake +++ b/llvm/cmake/modules/HandleLLVMStdlib.cmake @@ -31,4 +31,24 @@ if(NOT DEFINED LLVM_STDLIB_HANDLED) message(WARNING "Not sure how to specify libc++ for this compiler") endif() endif() + + if(LLVM_STATIC_LINK_CXX_STDLIB) + if(LLVM_COMPILER_IS_GCC_COMPATIBLE) + check_cxx_compiler_flag("-static-libstdc++" + CXX_COMPILER_SUPPORTS_STATIC_STDLIB) + check_linker_flag("-static-libstdc++" CXX_LINKER_SUPPORTS_STATIC_STDLIB) + if(CXX_COMPILER_SUPPORTS_STATIC_STDLIB AND + CXX_LINKER_SUPPORTS_STATIC_STDLIB) + append("-static-libstdc++" + CMAKE_EXE_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS + CMAKE_MODULE_LINKER_FLAGS) + else() + message(WARNING + "Can't specify static linking for the C++ standard library") + endif() + else() + message(WARNING "Not sure how to specify static linking of C++ standard " + "library for this compiler") + endif() + endif() endif() |

