add: enable address sanitizer for supported platforms
This commit is contained in:
parent
11ac67274b
commit
8e40e5a7bc
|
|
@ -3,8 +3,18 @@ PROJECT(leetcode-cpp)
|
|||
|
||||
SET(CMAKE_CXX_STANDARD 23)
|
||||
|
||||
# -Ofast -march=native -mtune=native -finline-functions -ffast-math -fomit-frame-pointer
|
||||
SET(CMAKE_CXX_FLAGS "-Wall")
|
||||
IF(MSVC)
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
|
||||
ELSE()
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -g3")
|
||||
ENDIF()
|
||||
|
||||
IF(UNIX)
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer")
|
||||
ENDIF()
|
||||
|
||||
# Optimisation
|
||||
# SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Ofast -march=native -mtune=native -finline-functions -ffast-math -fomit-frame-pointer")
|
||||
|
||||
ADD_EXECUTABLE(leetcode-cpp main.cpp)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue