Added address sanitizer to CMakeLists

This commit is contained in:
Ian Bell
2014-08-19 01:48:04 +02:00
parent f6169b073e
commit 11152ebcdf

View File

@@ -669,10 +669,24 @@ if (COOLPROP_SNIPPETS)
endif()
if()
if (COOLPROP_CLANG_ADDRESS_SANITIZER)
SET(CMAKE_CXX_FLAGS "-fsanitize=address")
list(APPEND APP_SOURCES "${CMAKE_SOURCE_DIR}/src/Tests/test_main.cxx")
# CATCH TEST, compile everything with catch and set test entry point
add_executable (CatchTestRunner ${APP_SOURCES})
add_dependencies (CatchTestRunner generate_headers)
set_target_properties (CatchTestRunner PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS} -DENABLE_CATCH")
if(UNIX)
target_link_libraries (CatchTestRunner ${CMAKE_DL_LIBS})
endif()
add_custom_command(TARGET CatchTestRunner
POST_BUILD
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/CatchTestRunner)
endif()
if (COOLPROP_PROFILE)
if(CMAKE_COMPILER_IS_GNUCXX)
SET(CMAKE_CXX_FLAGS "-g -O2")