Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Analyze Compile Flags #3321

Merged
merged 1 commit into from
Jan 6, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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")
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")
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")
add_compile_options(-fno-omit-frame-pointer -fsanitize=undefined -fsanitize=bounds)
endif ()
endif (LINUX OR DARWIN)
Loading