melonDS/cmake/Sanitizers.cmake
Nadia Holmquist Pedersen fbf753257b cmake: Add easy sanitizers option
Set -DSANITIZE to a comma-separated list of options to pass to
-fsanitize=, like -DSANITIZE=address,undefined
2024-10-19 18:30:30 +02:00

8 lines
272 B
CMake

set(SANITIZE "" CACHE STRING "Sanitizers to enable.")
string(REGEX MATCHALL "[^,]+" ENABLED_SANITIZERS "${SANITIZE}")
foreach(SANITIZER ${ENABLED_SANITIZERS})
add_compile_options("-fsanitize=${SANITIZER}")
add_link_options("-fsanitize=${SANITIZER}")
endforeach()