diff --git a/CMLibCompilerFlags.cmake b/CMLibCompilerFlags.cmake index 2868e39..ebacc04 100644 --- a/CMLibCompilerFlags.cmake +++ b/CMLibCompilerFlags.cmake @@ -113,6 +113,16 @@ if(CMAKE_CXX_COMPILER_IS_GCC) # Let's just disable the warning for now. check_enable_cxx_flag(-Wno-attributes) endif() + + set(CMAKE_REQUIRED_QUIET TRUE) + check_cxx_compiler_flag(-fanalyzer ANALYZER_GCC_FLAG) + unset(CMAKE_REQUIRED_QUIET) + if(ANALYZER_GCC_FLAG) + option(CMLIB_ENABLE_GCC_ANALYZER "Enable GCC -fanalyzer option" OFF) + if(CMLIB_ENABLE_GCC_ANALYZER) + add_compile_options("-fanalyzer") + endif() + endif() endif() if(CMAKE_SYSTEM_PROCESSOR STREQUAL "e2k")