Skip to content

Commit

Permalink
fix CMake ASan test in MSYS2 Clang and WSL (#1224)
Browse files Browse the repository at this point in the history
  • Loading branch information
rfomin authored Oct 13, 2023
1 parent 3e93db4 commit f61e88f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion cmake/WoofSettings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,15 @@ endif()

option(ENABLE_ASAN "Enable ASan" OFF)
if(ENABLE_ASAN)
_checked_add_compile_option(-fsanitize=address)
if(MSVC)
_checked_add_compile_option(-fsanitize=address)
else()
# Set -Werror to catch "argument unused during compilation" warnings.
# Also needs to be a link flag for test to pass.
set(CMAKE_REQUIRED_FLAGS "-Werror -fsanitize=address")
_checked_add_compile_option(-fsanitize=address)
unset(CMAKE_REQUIRED_FLAGS)
endif()
_checked_add_compile_option(-fno-omit-frame-pointer)
_checked_add_link_option(-fsanitize=address)
endif()
Expand Down

0 comments on commit f61e88f

Please sign in to comment.