summaryrefslogtreecommitdiff
path: root/lib/CMakeLists.txt
diff options
context:
space:
mode:
authorAlexey Samsonov <vonosmas@gmail.com>2014-08-08 22:01:20 +0000
committerAlexey Samsonov <vonosmas@gmail.com>2014-08-08 22:01:20 +0000
commitbeab84b64ef5547c6b1eb19654cc90071e60fbf5 (patch)
tree4816c0e4017558fb9e6914fe4f06a478f1516024 /lib/CMakeLists.txt
parenta7ff1013793a63f96e2ca652c369f6751ef1bd5d (diff)
[CMake] Determine which compiler-rt libraries are supported on
a given platform in a top-level CMakeLists.txt to use it both in lib/ and in test/ subdirectories. Move architecture/platform checks to config-ix. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@215247 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CMakeLists.txt')
-rw-r--r--lib/CMakeLists.txt66
1 files changed, 35 insertions, 31 deletions
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
index fcde9a20c..f13b5713d 100644
--- a/lib/CMakeLists.txt
+++ b/lib/CMakeLists.txt
@@ -3,37 +3,41 @@
include(AddCompilerRT)
include(SanitizerUtils)
-# Don't build sanitizers in the bootstrap build.
-if(NOT LLVM_USE_SANITIZER)
- # AddressSanitizer is supported on Linux, FreeBSD and Mac OS X.
- # 32-bit Windows support is experimental.
- if(CMAKE_SYSTEM_NAME MATCHES "Darwin|Linux|FreeBSD")
- set(SUPPORTS_BUILDING_ASAN TRUE)
- elseif(CMAKE_SYSTEM_NAME MATCHES "Windows"
- AND MSVC AND CMAKE_SIZEOF_VOID_P EQUAL 4)
- set(SUPPORTS_BUILDING_ASAN TRUE)
- else()
- set(SUPPORTS_BUILDING_ASAN FALSE)
- endif()
- if(SUPPORTS_BUILDING_ASAN)
- add_subdirectory(asan)
- add_subdirectory(interception)
- add_subdirectory(sanitizer_common)
- endif()
- if(CMAKE_SYSTEM_NAME MATCHES "Darwin|Linux|FreeBSD" AND NOT ANDROID)
- # LSan, UBsan and profile can be built on Mac OS, FreeBSD and Linux.
- add_subdirectory(lsan)
- add_subdirectory(profile)
- add_subdirectory(ubsan)
- endif()
- if(CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT ANDROID)
- # ThreadSanitizer and MemorySanitizer are supported on Linux only.
- add_subdirectory(tsan)
- add_subdirectory(tsan/dd)
- add_subdirectory(msan)
- add_subdirectory(msandr)
- add_subdirectory(dfsan)
- endif()
+
+if(COMPILER_RT_HAS_SANITIZER_COMMON)
+ add_subdirectory(interception)
+ add_subdirectory(sanitizer_common)
+endif()
+
+if(COMPILER_RT_HAS_ASAN)
+ add_subdirectory(asan)
endif()
add_subdirectory(builtins)
+
+if(COMPILER_RT_HAS_DFSAN)
+ add_subdirectory(dfsan)
+endif()
+
+if(COMPILER_RT_HAS_LSAN)
+ add_subdirectory(lsan)
+endif()
+
+if(COMPILER_RT_HAS_MSAN)
+ add_subdirectory(msan)
+ add_subdirectory(msandr)
+endif()
+
+if(COMPILER_RT_HAS_PROFILE)
+ add_subdirectory(profile)
+endif()
+
+if(COMPILER_RT_HAS_TSAN)
+ add_subdirectory(tsan)
+ add_subdirectory(tsan/dd)
+endif()
+
+if(COMPILER_RT_HAS_UBSAN)
+ add_subdirectory(ubsan)
+endif()
+