Added cmake command line option to build with clang/gcc address sanitizer enabled.

This commit is contained in:
harry 2022-08-03 18:51:10 -04:00 committed by zeromus
parent 1b32752800
commit 02bf3dbb4d
1 changed files with 9 additions and 1 deletions

View File

@ -85,6 +85,14 @@ else(WIN32)
#endif()
add_definitions( -D__QT_DRIVER__ -DQT_DEPRECATED_WARNINGS )
if ( ${ASAN_ENABLE} )
add_definitions( -fsanitize=address -fsanitize=bounds-strict )
set( ASAN_LDFLAGS -lasan -lubsan)
message( STATUS "Address Sanitizer Enabled" )
else()
message( STATUS "Address Sanitizer Disabled" )
endif()
# Check for libminizip
pkg_check_modules( MINIZIP REQUIRED minizip)
@ -613,7 +621,7 @@ add_executable( ${APP_NAME} ${SOURCES} ../resources.qrc
${CMAKE_CURRENT_BINARY_DIR}/fceux_git_info.cpp)
endif()
target_link_libraries( ${APP_NAME}
target_link_libraries( ${APP_NAME} ${ASAN_LDFLAGS}
${${Qt}Widgets_LIBRARIES}
${${Qt}Help_LIBRARIES}
${${Qt}OpenGL_LIBRARIES}