Add sanitizer option to build and add CI that uses it (#184)

This commit is contained in:
Lee *!* Clagett
2025-09-23 11:13:17 -04:00
committed by Lee *!* Clagett
parent a11482c123
commit 48060d1111
2 changed files with 63 additions and 0 deletions

View File

@@ -45,6 +45,17 @@ endif()
set (LWS_BUILD_TESTS "${BUILD_TESTS}")
set (BUILD_TESTS "Off")
option(SANITIZER "Use specific sanitizer" OFF)
if(NOT SANITIZER STREQUAL "OFF")
if (MSVC)
message(FATAL_ERROR "Cannot sanitize with MSVC")
else()
message(STATUS "Using sanitizer=${SANITIZER}")
add_compile_options("-fsanitize=${SANITIZER}")
add_link_options("-fsanitize=${SANITIZER}")
endif()
endif()
if(STATIC)
if(MSVC)
set(CMAKE_FIND_LIBRARY_SUFFIXES .lib .dll.a .a ${CMAKE_FIND_LIBRARY_SUFFIXES})