diff --git a/CMakeLists.txt b/CMakeLists.txt index 2b8f966af..611d1f8a3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -83,6 +83,15 @@ if(UNIX AND NOT APPLE) option(USE_LIBBFD "Use libbfd for crash reporting and leak check" OFF) endif() +if(USE_ASAN) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -fno-omit-frame-pointer") +endif() +if(USE_TSAN) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=thread -fno-omit-frame-pointer") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=thread -fno-omit-frame-pointer") +endif() + set(STK_SOURCE_DIR "src") set(STK_DATA_DIR "${PROJECT_SOURCE_DIR}/data") set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin") @@ -648,11 +657,9 @@ if(UNIX AND NOT APPLE) endif() endif() if(USE_ASAN) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer") target_link_libraries(supertuxkart "-fsanitize=address") endif() if(USE_TSAN) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=thread -fno-omit-frame-pointer") target_link_libraries(supertuxkart "-fsanitize=thread") endif() endif()