Skip to content
Snippets Groups Projects
Commit c2d69ba8 authored by Federico Montesino Pouzols's avatar Federico Montesino Pouzols
Browse files

Merge pull request #703 from mantidproject/11187_threadsanitizer

AddressSanitizer
parents 2b4d99fc a76d46b1
No related branches found
No related tags found
No related merge requests found
......@@ -37,9 +37,19 @@ endif()
set( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -fno-omit-frame-pointer" )
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-omit-frame-pointer" )
option(WITH_ASAN "Enable address sanitizer" OFF)
if(WITH_ASAN)
message(STATUS "enabling address sanitizer")
add_compile_options(-fno-omit-frame-pointer -fno-common -fsanitize=address)
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -fsanitize=address -lasan" )
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address -lasan" )
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fsanitize=address -lasan" )
endif()
# Set the options for gcc and g++
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${GNUFLAGS}" )
# -Wno-overloaded-virtual is down here because it's not applicable to the C_FLAGS
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GNUFLAGS} -Woverloaded-virtual -fno-operator-names -std=c++0x" )
# Cleanup
set ( GNUFLAGS )
......@@ -397,8 +397,12 @@ set_property ( TARGET Kernel PROPERTY FOLDER "MantidFramework" )
if ( GCC_COMPILER_VERSION AND GCC_COMPILER_VERSION VERSION_LESS "4.5" )
target_link_libraries ( Kernel stdc++ )
endif()
target_link_libraries ( Kernel ${NEXUS_LIBRARIES} ${MANTIDLIBS} ${GSL_LIBRARIES}
${NETWORK_LIBRARIES} ${JSONCPP_LIBRARIES} )
target_link_libraries ( Kernel ${NEXUS_LIBRARIES} ${MANTIDLIBS} ${GSL_LIBRARIES}
${NETWORK_LIBRARIES} ${JSONCPP_LIBRARIES})
if (WITH_ASAN)
target_link_libraries ( Kernel -lasan )
endif ()
if ( WIN32 )
target_link_libraries ( Kernel Psapi.lib ) # For memory usage queries
endif()
......
......@@ -890,6 +890,11 @@ target_link_libraries ( MantidPlot
${PYTHON_LIBRARIES}
${ZLIB_LIBRARIES}
)
if (WITH_ASAN)
target_link_libraries ( MantidPlot -lasan )
endif ()
# Plugin dependencies
add_dependencies( MantidPlot mantidqtpython )
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment