Skip to content

Commit

Permalink
Add ASan build (#81)
Browse files Browse the repository at this point in the history
-----

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
ManuelHu and pre-commit-ci[bot] authored May 8, 2024
1 parent ddd8fc2 commit 8e13c66
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion cmake/modules/BuildType.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,21 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
"${default_build_type}"
CACHE STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel"
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "ASan" "Debug" "Release" "MinSizeRel"
"RelWithDebInfo")
else()
message(STATUS "Setting build type to '${CMAKE_BUILD_TYPE}'")
endif()

# build flags for special ASAN build.
set(CMAKE_C_FLAGS_ASAN
"${CMAKE_C_FLAGS_DEBUG} -fsanitize=address,undefined -fno-omit-frame-pointer")

set(CMAKE_CXX_FLAGS_ASAN
"${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=address,undefined -fno-omit-frame-pointer")

set(CMAKE_EXE_LINKER_FLAGS_ASAN
"${CMAKE_EXE_LINKER_FLAGS_DEBUG} -fsanitize=address,undefined -static-libasan")

set(CMAKE_SHARED_LINKER_FLAGS_ASAN
"${CMAKE_SHARED_LINKER_FLAGS_DEBUG} -fsanitize=address,undefined -static-libasan")

0 comments on commit 8e13c66

Please sign in to comment.