on xenial help sign in
Add support for compiler sanitizers via ECM
commit8cbeffdddaa94d744b6fdb8779996ffac67ab923 authorAlbert Astals Cid <albert.astals@canonical.com> dateWed 7 Dec 2016, 13:42 (10 years ago) parentdb500d308541cc
1 file changed+7
CMakeLists.txt+7
CMakeLists.txt+7
@@ -40,6 +40,13 @@ if(cmake_build_type_lower MATCHES coverage)
4040 ENABLE_COVERAGE_REPORT(TARGETS ${SHELL_APP} FILTER /usr/include ${CMAKE_SOURCE_DIR}/tests/* ${CMAKE_BINARY_DIR}/*)
4141endif()
4242
43+find_package (ECM 1.7.0 QUIET NO_MODULE)
44+if (ECM_FOUND)
45+ # Provides us with -DECM_ENABLE_SANITIZERS='X'
46+ # Where X can be address, thread, memory, leak, undefined
47+ include("${ECM_MODULE_DIR}/ECMEnableSanitizers.cmake")
48+endif()
49+
4350if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
4451 if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "5.0.0")
4552 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wsuggest-override" )