diff options
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/Sanitizer.cmake | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/cmake/Sanitizer.cmake b/cmake/Sanitizer.cmake index 34ef288a7..73d72da8d 100644 --- a/cmake/Sanitizer.cmake +++ b/cmake/Sanitizer.cmake @@ -16,6 +16,8 @@ if (SANITIZE) set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SAN_FLAGS} -fsanitize=address -fsanitize-address-use-after-scope") set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${SAN_FLAGS} -fsanitize=address -fsanitize-address-use-after-scope") if (COMPILER_GCC) + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static-libasan") + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libasan") set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address -fsanitize-address-use-after-scope") set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libasan") endif () @@ -27,6 +29,8 @@ if (SANITIZE) set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${SAN_FLAGS} ${MSAN_FLAGS}") if (COMPILER_GCC) + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static-libmsan") + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libmsan") set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=memory") set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libmsan") endif () @@ -34,10 +38,10 @@ if (SANITIZE) elseif (SANITIZE STREQUAL "undefined") set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SAN_FLAGS} -fsanitize=undefined -fno-sanitize-recover=all") set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${SAN_FLAGS} -fsanitize=undefined -fno-sanitize-recover=all") - if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + if (COMPILER_GCC) + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static-libubsan") + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libubsan") set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=undefined") - endif() - if (CMAKE_C_COMPILER_ID STREQUAL "GNU") set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libubsan") endif () |