diff options
author | Petr Hosek <phosek@chromium.org> | 2018-05-18 01:10:09 +0000 |
---|---|---|
committer | Petr Hosek <phosek@chromium.org> | 2018-05-18 01:10:09 +0000 |
commit | 2dd07cd53a1eee60554f58ab232ce9e546d0e45d (patch) | |
tree | c82797a4dc719caf290307d2f43e0fb7e647875c /cmake/config-ix.cmake | |
parent | 458805f19b875ba108f5e6e1f342ecf498fb297f (diff) |
[CMake] Detect the compiler runtime and standard library
Rather then requiring the user to specify runtime the compiler
runtime and C++ standard library, or trying to guess them which is
error-prone, use auto-detection by parsing the compiler link output.
Differential Revision: https://reviews.llvm.org/D46857
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@332683 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'cmake/config-ix.cmake')
-rw-r--r-- | cmake/config-ix.cmake | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake index 4a9d840b2..a61d92356 100644 --- a/cmake/config-ix.cmake +++ b/cmake/config-ix.cmake @@ -13,7 +13,10 @@ function(check_linker_flag flag out_var) endfunction() check_library_exists(c fopen "" COMPILER_RT_HAS_LIBC) -if (NOT SANITIZER_USE_COMPILER_RT) +if (COMPILER_RT_RUNTIME_LIBRARY STREQUAL "compiler-rt") + include(HandleCompilerRT) + find_compiler_rt_library(builtins COMPILER_RT_BUILTINS_LIBRARY) +else() if (ANDROID) check_library_exists(gcc __gcc_personality_v0 "" COMPILER_RT_HAS_GCC_LIB) else() @@ -27,9 +30,7 @@ if (COMPILER_RT_HAS_NODEFAULTLIBS_FLAG) if (COMPILER_RT_HAS_LIBC) list(APPEND CMAKE_REQUIRED_LIBRARIES c) endif () - if (SANITIZER_USE_COMPILER_RT) - list(APPEND CMAKE_REQUIRED_FLAGS -rtlib=compiler-rt) - find_compiler_rt_library(builtins COMPILER_RT_BUILTINS_LIBRARY) + if (COMPILER_RT_RUNTIME_LIBRARY STREQUAL "compiler-rt") list(APPEND CMAKE_REQUIRED_LIBRARIES "${COMPILER_RT_BUILTINS_LIBRARY}") elseif (COMPILER_RT_HAS_GCC_S_LIB) list(APPEND CMAKE_REQUIRED_LIBRARIES gcc_s) |