Ladybird/CMake: Add options for enabling {A,M,UB}SAN

This patch adds convenient flags for enabling ASAN, MSAN and UBSAN.
This commit is contained in:
networkException 2022-10-19 21:12:29 +02:00 committed by Andrew Kaster
parent 8b593c9884
commit d1b2c2977e
Notes: sideshowbarker 2024-07-17 02:40:58 +09:00

View file

@ -29,6 +29,21 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
include(cmake/EnableLLD.cmake)
if (ENABLE_ADDRESS_SANITIZER)
add_compile_options(-fsanitize=address -fno-omit-frame-pointer)
add_link_options(-fsanitize=address)
endif()
if (ENABLE_MEMORY_SANITIZER)
add_compile_options(-fsanitize=memory -fsanitize-memory-track-origins -fno-omit-frame-pointer)
add_link_options(-fsanitize=memory -fsanitize-memory-track-origins)
endif()
if (ENABLE_UNDEFINED_SANITIZER)
add_compile_options(-fsanitize=undefined -fno-omit-frame-pointer)
add_link_options(-fsanitize=undefined)
endif()
# Lagom
include(FetchContent)
include(cmake/FetchLagom.cmake)