Skip to content

Commit

Permalink
Add 'WITH_ASAN' cmake option to enable AddressSanitizer compile options
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Aug 10, 2022
1 parent 0580369 commit c5a6509
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions CMakeLists.txt
Expand Up @@ -1042,6 +1042,16 @@ if (WITH_CORE)
endif()
endif()

####################################################
# asan
set (WITH_ASAN FALSE CACHE BOOL "Use AddressSanitizer")
mark_as_advanced(WITH_ASAN)
if(WITH_ASAN)
message(STATUS "Enabling AddressSanitizer")
add_compile_options(-fsanitize=address)
add_link_options(-fsanitize=address)
endif()

#############################################################
# process subdirs

Expand Down

0 comments on commit c5a6509

Please sign in to comment.