Mercurial > molko
changeset 176:408e4823e378
cmake: add sone -fsanitize in Debug builds
author | David Demelier <markand@malikania.fr> |
---|---|
date | Fri, 23 Oct 2020 09:30:54 +0200 |
parents | ce789473567e |
children | 6a15145b331e |
files | CMakeLists.txt |
diffstat | 1 files changed, 6 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/CMakeLists.txt Thu Oct 22 15:27:57 2020 +0200 +++ b/CMakeLists.txt Fri Oct 23 09:30:54 2020 +0200 @@ -28,6 +28,12 @@ set(CMAKE_C_FLAGS "-Wall -Wextra ${CMAKE_C_FLAGS}") endif () +if (CMAKE_C_COMPILER_ID MATCHES "Clang") + set(options "-fsanitize=address -fsanitize=undefined -fsanitize=integer") + set(CMAKE_C_FLAGS_DEBUG "-fno-omit-frame-pointer ${options} ${CMAKE_C_FLAGS_DEBUG}") + set(CMAKE_EXE_LINKER_FLAGS "${options} ${CMAKE_EXE_LINKER_FLAGS}") +endif () + set_property(GLOBAL PROPERTY USE_FOLDERS On) include(GNUInstallDirs)