Skip to content
This repository was archived by the owner on May 21, 2019. It is now read-only.

Commit 0e0eb19

Browse files
author
Chris Bieneman
committed
[CMake] Add options to control building sanitizers and builtins.
There are situations where a user may want to build only the compiler-rt builtins, or only the sanitizer runtimes. This exposes options to do that. Both default to On, so there should be no implicit change in behavior. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@247607 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 52ac608 commit 0e0eb19

File tree

2 files changed

+45
-36
lines changed

2 files changed

+45
-36
lines changed

CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ endif()
4343
# Top level target used to build all compiler-rt libraries.
4444
add_custom_target(compiler-rt ALL)
4545

46+
option(COMPILER_RT_BUILD_BUILTINS "Build builtins" ON)
47+
mark_as_advanced(COMPILER_RT_BUILD_BUILTINS)
48+
option(COMPILER_RT_BUILD_SANITIZERS "Build sanitizers" ON)
49+
mark_as_advanced(COMPILER_RT_BUILD_SANITIZERS)
50+
4651
if (NOT COMPILER_RT_STANDALONE_BUILD)
4752
# Compute the Clang version from the LLVM version.
4853
# FIXME: We should be able to reuse CLANG_VERSION variable calculated

lib/CMakeLists.txt

Lines changed: 40 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -4,40 +4,44 @@
44
include(AddCompilerRT)
55
include(SanitizerUtils)
66

7-
if(COMPILER_RT_HAS_INTERCEPTION)
8-
add_subdirectory(interception)
9-
endif()
10-
11-
if(COMPILER_RT_HAS_SANITIZER_COMMON)
12-
add_subdirectory(sanitizer_common)
13-
add_subdirectory(cfi)
14-
add_subdirectory(lsan)
15-
add_subdirectory(ubsan)
16-
endif()
17-
18-
if(COMPILER_RT_HAS_ASAN)
19-
add_subdirectory(asan)
20-
endif()
21-
22-
add_subdirectory(builtins)
23-
24-
if(COMPILER_RT_HAS_DFSAN)
25-
add_subdirectory(dfsan)
26-
endif()
27-
28-
if(COMPILER_RT_HAS_MSAN)
29-
add_subdirectory(msan)
30-
endif()
31-
32-
if(COMPILER_RT_HAS_PROFILE)
33-
add_subdirectory(profile)
34-
endif()
35-
36-
if(COMPILER_RT_HAS_TSAN)
37-
add_subdirectory(tsan)
38-
add_subdirectory(tsan/dd)
39-
endif()
40-
41-
if(COMPILER_RT_HAS_SAFESTACK)
42-
add_subdirectory(safestack)
7+
if(COMPILER_RT_BUILD_BUILTINS)
8+
add_subdirectory(builtins)
9+
endif()
10+
11+
if(COMPILER_RT_BUILD_SANITIZERS)
12+
if(COMPILER_RT_HAS_INTERCEPTION)
13+
add_subdirectory(interception)
14+
endif()
15+
16+
if(COMPILER_RT_HAS_SANITIZER_COMMON)
17+
add_subdirectory(sanitizer_common)
18+
add_subdirectory(cfi)
19+
add_subdirectory(lsan)
20+
add_subdirectory(ubsan)
21+
endif()
22+
23+
if(COMPILER_RT_HAS_ASAN)
24+
add_subdirectory(asan)
25+
endif()
26+
27+
if(COMPILER_RT_HAS_DFSAN)
28+
add_subdirectory(dfsan)
29+
endif()
30+
31+
if(COMPILER_RT_HAS_MSAN)
32+
add_subdirectory(msan)
33+
endif()
34+
35+
if(COMPILER_RT_HAS_PROFILE)
36+
add_subdirectory(profile)
37+
endif()
38+
39+
if(COMPILER_RT_HAS_TSAN)
40+
add_subdirectory(tsan)
41+
add_subdirectory(tsan/dd)
42+
endif()
43+
44+
if(COMPILER_RT_HAS_SAFESTACK)
45+
add_subdirectory(safestack)
46+
endif()
4347
endif()

0 commit comments

Comments
 (0)