Skip to content

Instantly share code, notes, and snippets.

@azeey
Created January 10, 2020 17:07
Show Gist options
  • Save azeey/ed2ebb77e1494871d538f5c7e9e4ed18 to your computer and use it in GitHub Desktop.
Save azeey/ed2ebb77e1494871d538f5c7e9e4ed18 to your computer and use it in GitHub Desktop.
Add address and leak sanitizer to sdformat
diff --git a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -199,16 +199,21 @@ else()
endif()
filter_valid_compiler_warnings(${WARN_LEVEL} -Wextra -Wno-long-long
-Wno-unused-value -Wno-unused-value -Wno-unused-value -Wno-unused-value
-Wfloat-equal -Wshadow -Winit-self -Wswitch-default
-Wmissing-include-dirs -pedantic -Wno-pragmas)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}${WARNING_CXX_FLAGS} ${UNFILTERED_FLAGS}")
+
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fsanitize=leak -g")
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -fsanitize=leak -g")
+set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address -fsanitize=leak")
+set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -fsanitize=address -fsanitize=leak")
#################################################
# OS Specific initialization
if (UNIX)
sdf_setup_unix()
endif ()
if (WIN32)
sdf_setup_windows()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment