diff options
author | Alexey Samsonov <samsonov@google.com> | 2013-01-18 16:51:07 +0000 |
---|---|---|
committer | Alexey Samsonov <samsonov@google.com> | 2013-01-18 16:51:07 +0000 |
commit | 43b4b9c18a7a588a60b9d976391ad8e2f5f9a309 (patch) | |
tree | 7ed618e62e12ce199f079a5a8cc3b0b7a8e3fa4c /lib/ubsan | |
parent | dedba5d6b0664218b1b1109f024a1ab151642776 (diff) |
CMake: Generalize build rules for different arches for sanitizer_common, asan, ubsan
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@172829 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ubsan')
-rw-r--r-- | lib/ubsan/CMakeLists.txt | 30 |
1 files changed, 11 insertions, 19 deletions
diff --git a/lib/ubsan/CMakeLists.txt b/lib/ubsan/CMakeLists.txt index 7d5bf01cf..40d0e8971 100644 --- a/lib/ubsan/CMakeLists.txt +++ b/lib/ubsan/CMakeLists.txt @@ -12,6 +12,9 @@ include_directories(..) set(UBSAN_CFLAGS ${SANITIZER_COMMON_CFLAGS}) +filter_available_targets(UBSAN_SUPPORTED_ARCH + x86_64 i386) + set(UBSAN_RUNTIME_LIBRARIES) if(APPLE) @@ -21,32 +24,21 @@ if(APPLE) $<TARGET_OBJECTS:RTSanitizerCommon.osx> ) set_target_compile_flags(clang_rt.ubsan_osx ${UBSAN_CFLAGS}) - filter_available_targets(UBSAN_TARGETS x86_64 i386) set_target_properties(clang_rt.ubsan_osx PROPERTIES - OSX_ARCHITECTURES "${UBSAN_TARGETS}") + OSX_ARCHITECTURES "${UBSAN_SUPPORTED_ARCH}") list(APPEND UBSAN_RUNTIME_LIBRARIES clang_rt.ubsan_osx) else() # Build separate libraries for each target. - if(CAN_TARGET_x86_64) - add_library(clang_rt.ubsan-x86_64 STATIC - ${UBSAN_SOURCES} - $<TARGET_OBJECTS:RTSanitizerCommon.x86_64> - ) - set_target_compile_flags(clang_rt.ubsan-x86_64 - ${UBSAN_CFLAGS} ${TARGET_x86_64_CFLAGS} - ) - list(APPEND UBSAN_RUNTIME_LIBRARIES clang_rt.ubsan-x86_64) - endif() - if(CAN_TARGET_i386) - add_library(clang_rt.ubsan-i386 STATIC + foreach(arch ${UBSAN_SUPPORTED_ARCH}) + add_library(clang_rt.ubsan-${arch} STATIC ${UBSAN_SOURCES} - $<TARGET_OBJECTS:RTSanitizerCommon.i386> + $<TARGET_OBJECTS:RTSanitizerCommon.${arch}> ) - set_target_compile_flags(clang_rt.ubsan-i386 - ${UBSAN_CFLAGS} ${TARGET_i386_CFLAGS} + set_target_compile_flags(clang_rt.ubsan-${arch} + ${UBSAN_CFLAGS} ${TARGET_${arch}_CFLAGS} ) - list(APPEND UBSAN_RUNTIME_LIBRARIES clang_rt.ubsan-i386) - endif() + list(APPEND UBSAN_RUNTIME_LIBRARIES clang_rt.ubsan-${arch}) + endforeach() endif() |