diff --git a/modules/compiler/gcc.cmake b/modules/compiler/gcc.cmake index e07cba1..ad7dfae 100644 --- a/modules/compiler/gcc.cmake +++ b/modules/compiler/gcc.cmake @@ -103,6 +103,9 @@ AppendWarningFlag("-Wuse-after-free") #Warns about accessing a value after calling 'free' on it AppendWarningFlag("-Wuseless-cast") #Warns about a cast that is useless. + AppendWarningFlag("-Wno-non-virtual-dtor") + + AppendWarningFlag("-Wno-terminate") # Disables -Wterminate errors, These are kinda weird and I tend to use throw inside of dtors with the intent of it terminating after. So we'll just silence them. # Starting other weird flags AppendWarningFlag("-fdiagnostics-show-template-tree") # Shows the template diagnostic info as a tree instead. @@ -112,30 +115,29 @@ string(TOUPPER ${CMAKE_BUILD_TYPE} UPPER_BUILD_TYPE) - if (NOT DEFINED STATIC_ANAYLSIS) - set(STATIC_ANYLSIS 1) + if (NOT DEFINED FGL_STATIC_ANALYSIS) + set(FGL_STATIC_ANALYSIS 0) endif () - - # if (STATIC_ANALYSIS EQUAL 1 AND UPPER_BUILD_TYPE STREQUAL "DEBUG") - # list(APPEND FGL_CONFIG "-fanalyzer") - # if (NOT DEFINED USE_WERROR OR NOT USE_WERROR) - # list(APPEND FGL_CONFIG "-Wanalyzer-too-complex") - # endif () - # elseif (NOT UPPER_BUILD_TYPE STREQUAL "DEBUG") - if (NOT UPPER_BUILD_TYPE STREQUAL "DEBUG") + if (FGL_STATIC_ANALYSIS EQUAL 1) + list(APPEND FGL_CONFIG "-fanalyzer") + # list(APPEND FGL_CONFIG "-Wanalyzer-too-complex") + # Breaks more often then it is helpful + list(APPEND FGL_CONFIG "-Wno-analyzer-use-of-uninitialized-value") + list(APPEND FGL_CONFIG "-Wno-analyzer-malloc-leak") + elseif (NOT UPPER_BUILD_TYPE STREQUAL "DEBUG") list(APPEND FGL_CONFIG "-flto=auto") endif () list(APPEND FGL_CONFIG "-ftree-vectorize") - list(APPEND FGL_CONFIG "-fmax-errors=6") + list(APPEND FGL_CONFIG "-fmax-errors=2") LIST(APPEND FGL_CONFIG "-fmodules-ts") LIST(APPEND FGL_CONFIG "-std=c++23") #AppendWarningFlag("-fanalyzer") #AppendWarningFlag("-Wanalyzer-too-complex") - if (DEFINED USE_WERROR AND USE_WERROR) + if (DEFINED FGL_STRICT_WARNINGS AND FGL_STRICT_WARNINGS) list(APPEND FGL_CONFIG "-Werror") endif () diff --git a/modules/helpers.cmake b/modules/helpers.cmake index 53bc2cd..aa2c25d 100644 --- a/modules/helpers.cmake +++ b/modules/helpers.cmake @@ -32,6 +32,14 @@ function(AddFGLExecutable NAME SRC_SOURCES_LOCATION) SetFGLFlags(${NAME}) endfunction() +function(addFGLFlags NAME) + + if (DEFINED FGL_STRICT_WARNINGS AND FGL_STRICT_WARNINGS) + target_compile_definitions(${NAME} PUBLIC "-DFGL_STRICT_WARNINGS=1") + endif () + +endfunction() + function(AddFGLLibrary NAME MODE SRC_SOURCES_LOCATION INCLUDE_SOURCES_LOCATION) file(GLOB_RECURSE CPP_SOURCES CONFIGURE_DEPENDS ${SRC_SOURCES_LOCATION}/**.cpp) file(GLOB_RECURSE HPP_SOURCES CONFIGURE_DEPENDS ${SRC_SOURCES_LOCATION}/**.hpp) @@ -40,6 +48,7 @@ function(AddFGLLibrary NAME MODE SRC_SOURCES_LOCATION INCLUDE_SOURCES_LOCATION) target_include_directories(${NAME} PUBLIC ${INCLUDE_SOURCES_LOCATION}) target_include_directories(${NAME} PRIVATE ${SRC_SOURCES_LOCATION}) SetFGLFlags(${NAME}) + addFGLFlags(${NAME}) endfunction() function(AddFGLChildLibrary NAME MODE SRC_SOURCES_LOCATION INCLUDE_SOURCES_LOCATION)