Skip to content

Commit 3152a6f

Browse files
committed
Add Analyze Compile Flags
1 parent 43853c2 commit 3152a6f

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

indra/cmake/00-Common.cmake

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,14 @@ if (LINUX)
176176
-lm
177177
)
178178
endif()
179+
180+
if (CMAKE_BUILD_TYPE MATCHES "^RelWithDebInfo(OS)?$")
181+
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
182+
add_compile_options(--analyze)
183+
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
184+
add_compile_options(-fanalyzer)
185+
endif ()
186+
endif ()
179187
endif (LINUX)
180188

181189
if (DARWIN)
@@ -199,6 +207,10 @@ if (DARWIN)
199207
# required for clang-15/xcode-15 since our boost package still uses deprecated std::unary_function/binary_function
200208
# see https://developer.apple.com/documentation/xcode-release-notes/xcode-15-release-notes#C++-Standard-Library
201209
add_compile_definitions(_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION)
210+
211+
if (CMAKE_BUILD_TYPE MATCHES "^RelWithDebInfo(OS)?$")
212+
add_compile_options(--analyze)
213+
endif ()
202214
endif(DARWIN)
203215

204216
if(LINUX OR DARWIN)
@@ -214,4 +226,8 @@ if(LINUX OR DARWIN)
214226

215227
add_compile_options(${GCC_WARNINGS})
216228
add_compile_options(-m${ADDRESS_SIZE})
229+
230+
if (CMAKE_BUILD_TYPE MATCHES "^RelWithDebInfo(OS)?$")
231+
add_compile_options(-fno-omit-frame-pointer -fsanitize=undefined -fsanitize=bounds)
232+
endif ()
217233
endif (LINUX OR DARWIN)

0 commit comments

Comments
 (0)