Skip to content

Commit 8d25d43

Browse files
authored
allowing sanitizers to run (#12)
* allowing sanitizers to run * Update CMakeLists.txt
1 parent a42b24c commit 8d25d43

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,15 @@ else()
1919
message(STATUS "native target not supported")
2020
endif()
2121

22-
if (NOT CMAKE_BUILD_TYPE)
22+
if (NOT CMAKE_BUILD_TYPE AND NOT SANITIZE)
2323
message(STATUS "No build type selected, default to Release")
2424
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE)
2525
endif()
26+
if(SANITIZE)
27+
add_compile_options(-fsanitize=address -fno-omit-frame-pointer -fno-sanitize-recover=all)
28+
add_compile_definitions(ASAN_OPTIONS=detect_leaks=1)
29+
link_libraries(-fsanitize=address -fno-omit-frame-pointer -fno-sanitize-recover=all)
30+
endif()
2631
include(cmake/CPM.cmake)
2732

2833
add_subdirectory(dependencies)

0 commit comments

Comments
 (0)