Added function to set sanitizer blacklist.

This commit is contained in:
Alexander Haase 2016-04-15 14:25:58 +02:00
parent f566e2b9ec
commit 1cefaef507
2 changed files with 12 additions and 0 deletions

View File

@ -35,6 +35,16 @@ find_package(UBSan ${FIND_QUIETLY_FLAG})
function(sanitizer_add_blacklist_file FILE)
if(NOT IS_ABSOLUTE ${FILE})
set(FILE "${CMAKE_CURRENT_SOURCE_DIR}/${FILE}")
endif()
get_filename_component(FILE "${FILE}" REALPATH)
sanitizer_check_compiler_flags("-fsanitize-blacklist=${FILE}"
"SanitizerBlacklist" "SanBlist")
endfunction()
function(add_sanitizers TARGET) function(add_sanitizers TARGET)
add_sanitize_address(${TARGET}) add_sanitize_address(${TARGET})
add_sanitize_thread(${TARGET}) add_sanitize_thread(${TARGET})

View File

@ -150,6 +150,8 @@ function (saitizer_add_flags TARGET NAME PREFIX)
# Set compile- and link-flags for target. # Set compile- and link-flags for target.
set_property(TARGET ${TARGET} APPEND_STRING set_property(TARGET ${TARGET} APPEND_STRING
PROPERTY COMPILE_FLAGS " ${${PREFIX}_${TARGET_COMPILER}_FLAGS}") PROPERTY COMPILE_FLAGS " ${${PREFIX}_${TARGET_COMPILER}_FLAGS}")
set_property(TARGET ${TARGET} APPEND_STRING
PROPERTY COMPILE_FLAGS " ${SanBlist_${TARGET_COMPILER}_FLAGS}")
set_property(TARGET ${TARGET} APPEND_STRING set_property(TARGET ${TARGET} APPEND_STRING
PROPERTY LINK_FLAGS " ${${PREFIX}_${TARGET_COMPILER}_FLAGS}") PROPERTY LINK_FLAGS " ${${PREFIX}_${TARGET_COMPILER}_FLAGS}")
endfunction () endfunction ()