From 2056f588e3575e0dae35b66c288f0147fe7bbe39 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Wed, 19 Aug 2015 18:03:16 -0700 Subject: [PATCH] if environment variable HIFI_MEMORY_DEBUGGING is defined when cmake is run, enable -fsanitize=address on linux --- assignment-client/CMakeLists.txt | 10 +++++++++- domain-server/CMakeLists.txt | 8 ++++++++ interface/CMakeLists.txt | 8 ++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/assignment-client/CMakeLists.txt b/assignment-client/CMakeLists.txt index edd68e12bf..7e3b2e6af9 100644 --- a/assignment-client/CMakeLists.txt +++ b/assignment-client/CMakeLists.txt @@ -18,4 +18,12 @@ if (UNIX) endif (UNIX) include_application_version() -copy_dlls_beside_windows_executable() \ No newline at end of file +copy_dlls_beside_windows_executable() + +if (DEFINED ENV{HIFI_MEMORY_DEBUGGING}) + if (UNIX) + MESSAGE("-- assignment-client memory debugging is enabled.") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer") + SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address") + endif (UNIX) +endif () diff --git a/domain-server/CMakeLists.txt b/domain-server/CMakeLists.txt index e4fa1d874d..0d56e34cf2 100644 --- a/domain-server/CMakeLists.txt +++ b/domain-server/CMakeLists.txt @@ -33,3 +33,11 @@ target_link_libraries(${TARGET_NAME} ${OPENSSL_LIBRARIES}) include_application_version() copy_dlls_beside_windows_executable() + +if (DEFINED ENV{HIFI_MEMORY_DEBUGGING}) + if (UNIX) + MESSAGE("-- domain-server memory debugging is enabled.") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer") + SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address") + endif (UNIX) +endif () diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt index acafafa006..16d8bacd23 100644 --- a/interface/CMakeLists.txt +++ b/interface/CMakeLists.txt @@ -206,3 +206,11 @@ else (APPLE) endif (APPLE) copy_dlls_beside_windows_executable() + +if (DEFINED ENV{HIFI_MEMORY_DEBUGGING}) + if (UNIX) + MESSAGE("-- interface memory debugging is enabled.") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer") + SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address") + endif (UNIX) +endif ()