From a9584cc057115ebbc3b32aeb18f577f134f138c5 Mon Sep 17 00:00:00 2001 From: AiraYumi Date: Fri, 27 Dec 2024 16:07:44 +0900 Subject: [PATCH] Add Analyze Compile Flags --- indra/cmake/00-Common.cmake | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake index 7c3dc2d5afd..1c7ed311843 100644 --- a/indra/cmake/00-Common.cmake +++ b/indra/cmake/00-Common.cmake @@ -182,6 +182,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) @@ -203,6 +211,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) @@ -218,4 +230,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)