Skip to content

Commit

Permalink
Added sanitizers for Windows native workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
maxirmx committed Nov 16, 2023
1 parent b73929f commit c659ef6
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,14 @@ endif()

# sanitizers
if (ENABLE_SANITIZERS)
if (NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang")
message(FATAL_ERROR "Sanitizers have only been tested with the clang compiler.")
if (MSVC)
add_compile_options(/fsanitize=address /fsanitize=fuzzer /Zi)
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-fsanitize=leak,address,undefined -fno-omit-frame-pointer -fno-common -O1)
link_libraries(-fsanitize=leak,address,undefined)
else()
message(FATAL_ERROR "Sanitizers have only been tested with the Clang compiler or Microsoft Visual Studio.")
endif()
add_compile_options(-fsanitize=leak,address,undefined -fno-omit-frame-pointer -fno-common -O1)
link_libraries(-fsanitize=leak,address,undefined)
endif()

# adoc for man generation
Expand Down

0 comments on commit c659ef6

Please sign in to comment.