Add sanitizers for cmake (#2608)

These can be enabled using the `SANITIZE_{ADDRESS,MEMORY,THREAD,UNDEFINED}` cmake flags
This commit is contained in:
pajlada 2021-04-10 13:26:20 +02:00 committed by GitHub
parent 1a1cea9542
commit 208d017cc3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 9 additions and 0 deletions

3
.gitmodules vendored
View file

@ -25,3 +25,6 @@
[submodule "lib/websocketpp"] [submodule "lib/websocketpp"]
path = lib/websocketpp path = lib/websocketpp
url = https://github.com/ziocleto/websocketpp url = https://github.com/ziocleto/websocketpp
[submodule "cmake/sanitizers-cmake"]
path = cmake/sanitizers-cmake
url = https://github.com/arsenm/sanitizers-cmake

View file

@ -4,6 +4,7 @@ include(FeatureSummary)
list(APPEND CMAKE_MODULE_PATH list(APPEND CMAKE_MODULE_PATH
"${CMAKE_SOURCE_DIR}/cmake" "${CMAKE_SOURCE_DIR}/cmake"
"${CMAKE_SOURCE_DIR}/cmake/sanitizers-cmake/cmake"
) )
project(chatterino VERSION 2.2.3) project(chatterino VERSION 2.2.3)
@ -44,6 +45,8 @@ if (WIN32)
find_package(WinToast REQUIRED) find_package(WinToast REQUIRED)
endif () endif ()
find_package(Sanitizers)
# Find boost on the system # Find boost on the system
find_package(Boost REQUIRED) find_package(Boost REQUIRED)

@ -0,0 +1 @@
Subproject commit 99e159ec9bc8dd362b08d18436bd40ff0648417b

View file

@ -460,6 +460,7 @@ endif ()
source_group(TREE ${CMAKE_SOURCE_DIR} FILES ${SOURCE_FILES}) source_group(TREE ${CMAKE_SOURCE_DIR} FILES ${SOURCE_FILES})
add_executable(${PROJECT_NAME} ${SOURCE_FILES}) add_executable(${PROJECT_NAME} ${SOURCE_FILES})
add_sanitizers(${PROJECT_NAME})
target_precompile_headers(${PROJECT_NAME} PRIVATE PrecompiledHeader.hpp) target_precompile_headers(${PROJECT_NAME} PRIVATE PrecompiledHeader.hpp)

View file

@ -45,6 +45,7 @@ add_executable(${PROJECT_NAME}
${chatterino_SOURCES} ${chatterino_SOURCES}
${test_SOURCES} ${test_SOURCES}
) )
add_sanitizers(${PROJECT_NAME})
# Enable autogeneration of Qts MOC/RCC/UIC # Enable autogeneration of Qts MOC/RCC/UIC
set_target_properties(${PROJECT_NAME} set_target_properties(${PROJECT_NAME}