diff options
author | Leslie Zhai <xiangzhai83@gmail.com> | 2016-12-30 11:14:53 +0800 |
---|---|---|
committer | Leslie Zhai <xiangzhai83@gmail.com> | 2016-12-30 11:14:53 +0800 |
commit | c38e698cf3f33f2280d6d134bd0484d8051a33e7 (patch) | |
tree | 92deef8a7a01b24d33511d21897adb23e0c94e77 /modules | |
parent | d1d637fadd6dad68995d44101250ebbc3307ed0b (diff) | |
download | extra-cmake-modules-c38e698cf3f33f2280d6d134bd0484d8051a33e7.tar.gz extra-cmake-modules-c38e698cf3f33f2280d6d134bd0484d8051a33e7.tar.bz2 |
Add Clang Sanitizer CMAKE_C_FLAGS for C project
Test plan: Clang and GCC for simple C project, kcoreaddons, kjs, etc.
BUG: 374195
REVIEW: 129708
Reviewers: #extracmakemodules, alexmerry
Reviewed By: dfaure, aacid
Diffstat (limited to 'modules')
-rw-r--r-- | modules/ECMEnableSanitizers.cmake | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/modules/ECMEnableSanitizers.cmake b/modules/ECMEnableSanitizers.cmake index 9c8a4dee..a5aa0fa6 100644 --- a/modules/ECMEnableSanitizers.cmake +++ b/modules/ECMEnableSanitizers.cmake @@ -151,6 +151,10 @@ foreach ( CUR_SANITIZER ${ECM_ENABLE_SANITIZERS} ) string(TOLOWER ${CUR_SANITIZER} CUR_SANITIZER) # check option and enable appropriate flags enable_sanitizer_flags ( ${CUR_SANITIZER} ) + # TODO: GCC will not link pthread library if enabled ASan + if(CMAKE_C_COMPILER_ID MATCHES "Clang") + set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${XSAN_COMPILE_FLAGS}" ) + endif() set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${XSAN_COMPILE_FLAGS}" ) if(CMAKE_CXX_COMPILER_ID MATCHES "GNU") link_libraries(${XSAN_LINKER_FLAGS}) |