Skip to content

Commit

Permalink
Add Analyze Compile Flags
Browse files Browse the repository at this point in the history
  • Loading branch information
AiraYumi committed Jan 9, 2025
1 parent 43853c2 commit 3152a6f
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions indra/cmake/00-Common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,14 @@ if (LINUX)
-lm
)
endif()

if (CMAKE_BUILD_TYPE MATCHES "^RelWithDebInfo(OS)?$")
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
add_compile_options(--analyze)
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
add_compile_options(-fanalyzer)
endif ()
endif ()
endif (LINUX)

if (DARWIN)
Expand All @@ -199,6 +207,10 @@ if (DARWIN)
# required for clang-15/xcode-15 since our boost package still uses deprecated std::unary_function/binary_function
# see https://developer.apple.com/documentation/xcode-release-notes/xcode-15-release-notes#C++-Standard-Library
add_compile_definitions(_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION)

if (CMAKE_BUILD_TYPE MATCHES "^RelWithDebInfo(OS)?$")
add_compile_options(--analyze)
endif ()
endif(DARWIN)

if(LINUX OR DARWIN)
Expand All @@ -214,4 +226,8 @@ if(LINUX OR DARWIN)

add_compile_options(${GCC_WARNINGS})
add_compile_options(-m${ADDRESS_SIZE})

if (CMAKE_BUILD_TYPE MATCHES "^RelWithDebInfo(OS)?$")
add_compile_options(-fno-omit-frame-pointer -fsanitize=undefined -fsanitize=bounds)
endif ()
endif (LINUX OR DARWIN)

0 comments on commit 3152a6f

Please sign in to comment.