[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.

llvm-svn: 247607
This commit is contained in:
Chris Bieneman 2015-09-14 19:59:24 +00:00
parent fb92d9a249
commit 679ab85a7c
2 changed files with 36 additions and 27 deletions

View File

@ -43,6 +43,11 @@ endif()
# Top level target used to build all compiler-rt libraries.
add_custom_target(compiler-rt ALL)
option(COMPILER_RT_BUILD_BUILTINS "Build builtins" ON)
mark_as_advanced(COMPILER_RT_BUILD_BUILTINS)
option(COMPILER_RT_BUILD_SANITIZERS "Build sanitizers" ON)
mark_as_advanced(COMPILER_RT_BUILD_SANITIZERS)
if (NOT COMPILER_RT_STANDALONE_BUILD)
# Compute the Clang version from the LLVM version.
# FIXME: We should be able to reuse CLANG_VERSION variable calculated

View File

@ -4,40 +4,44 @@
include(AddCompilerRT)
include(SanitizerUtils)
if(COMPILER_RT_HAS_INTERCEPTION)
add_subdirectory(interception)
if(COMPILER_RT_BUILD_BUILTINS)
add_subdirectory(builtins)
endif()
if(COMPILER_RT_HAS_SANITIZER_COMMON)
add_subdirectory(sanitizer_common)
add_subdirectory(cfi)
add_subdirectory(lsan)
add_subdirectory(ubsan)
endif()
if(COMPILER_RT_BUILD_SANITIZERS)
if(COMPILER_RT_HAS_INTERCEPTION)
add_subdirectory(interception)
endif()
if(COMPILER_RT_HAS_ASAN)
add_subdirectory(asan)
endif()
if(COMPILER_RT_HAS_SANITIZER_COMMON)
add_subdirectory(sanitizer_common)
add_subdirectory(cfi)
add_subdirectory(lsan)
add_subdirectory(ubsan)
endif()
add_subdirectory(builtins)
if(COMPILER_RT_HAS_ASAN)
add_subdirectory(asan)
endif()
if(COMPILER_RT_HAS_DFSAN)
add_subdirectory(dfsan)
endif()
if(COMPILER_RT_HAS_DFSAN)
add_subdirectory(dfsan)
endif()
if(COMPILER_RT_HAS_MSAN)
add_subdirectory(msan)
endif()
if(COMPILER_RT_HAS_MSAN)
add_subdirectory(msan)
endif()
if(COMPILER_RT_HAS_PROFILE)
add_subdirectory(profile)
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_TSAN)
add_subdirectory(tsan)
add_subdirectory(tsan/dd)
endif()
if(COMPILER_RT_HAS_SAFESTACK)
add_subdirectory(safestack)
if(COMPILER_RT_HAS_SAFESTACK)
add_subdirectory(safestack)
endif()
endif()