diff --git a/CMakeLists.txt b/CMakeLists.txt index 724667f..b673298 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,6 +13,8 @@ if(${srcdir} STREQUAL ${bindir}) " Please remove them.") endif() +set(STATIC_ANALYZER OFF CACHE BOOL "Using GCC static analyzer if available") + project(odm C CXX) set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) @@ -28,6 +30,12 @@ if(COMPILER_SUPPORTS_DWARF4 AND (CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUIL add_compile_options(-gdwarf-4) endif() +# GCC static analyzer support check +CHECK_CXX_COMPILER_FLAG(-fanalyzer COMPILER_SUPPORTS_ANALYZER) +if(COMPILER_SUPPORTS_ANALYZER AND STATIC_ANALYZER) + add_compile_options(-fanalyzer) +endif() + add_library(teos STATIC GSW-C/gsw_oceanographic_toolbox.c GSW-C/gsw_saar.c) set_target_properties(teos PROPERTIES LINKER_LANGUAGE C)