Skip to content

Commit db7770f

Browse files
authored
Added sanitizer (#699)
1 parent 817f07b commit db7770f

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ option(XPYT_USE_SHARED_XEUS_PYTHON "Link xpython and xpython_extension with the
4444

4545
option(XPYT_EMSCRIPTEN_WASM_BUILD "Build for wasm with emscripten" OFF)
4646

47+
option(XPYT_SANITIZE_ADDRESS "Enable address sanitizer" OFF)
48+
4749
# Test options
4850
option(XPYT_BUILD_TESTS "xeus-python test suite" OFF)
4951

@@ -250,6 +252,10 @@ macro(xpyt_set_common_options target_name)
250252
CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR
251253
CMAKE_CXX_COMPILER_ID MATCHES "Intel")
252254
target_compile_options(${target_name} PUBLIC -Wunused-parameter -Wextra -Wreorder)
255+
if (XPYT_SANITIZE_ADDRESS)
256+
target_compile_options(${target_name} PUBLIC -fsanitize=address -fno-omit-frame-pointer)
257+
target_link_options(${target_name} PUBLIC -fsanitize=address)
258+
endif ()
253259
endif ()
254260
endmacro()
255261

0 commit comments

Comments
 (0)