Skip to content

Commit

Permalink
#132 Change a way to add sanitazers
Browse files Browse the repository at this point in the history
Signed-off-by: vityaman <vityaman.dev@yandex.ru>
  • Loading branch information
vityaman committed Jul 24, 2024
1 parent 991120d commit ef2777a
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions ports/cpp/cmake/Sanitize.cmake
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
set(UBSAN_COMPILE_FLAGS -fsanitize=undefined -fno-sanitize-recover=all)
set(UBSAN_LINK_FLAGS -fsanitize=undefined)
if(UBSAN)
add_compile_options(${UBSAN_COMPILE_FLAGS})
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${UBSAN_LINK_FLAGS}")
endif()
set(
CMAKE_CXX_FLAGS_ASAN "-g -fsanitize=address,undefined -fno-sanitize-recover=all"
CACHE STRING "Compiler flags in ASan build"
FORCE
)

set(ASAN_COMPILE_FLAGS -fsanitize=address,undefined -fno-sanitize-recover=all)
set(ASAN_LINK_FLAGS -fsanitize=address,undefined)
if(ASAN)
add_compile_options(${ASAN_COMPILE_FLAGS})
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${ASAN_LINK_FLAGS}")
endif()
set(
CMAKE_CXX_FLAGS_TSAN "-g -fsanitize=thread -fno-sanitize-recover=all"
CACHE STRING "Compiler flags in TSan build"
FORCE
)

0 comments on commit ef2777a

Please sign in to comment.