WarningFlags.cmake (2539B)
1 add_library(warning_flags INTERFACE) 2 3 if((CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") OR (CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC")) 4 target_compile_options(warning_flags INTERFACE 5 /W4 # base warning level 6 #/wd4458 # declaration hides class member (from Foley's GUI Magic) 7 /wd4505 # since VS2019 doesn't handle [[ maybe_unused ]] for static functions (RTNeural::debug_print) 8 /wd4244 # for XSIMD 9 ) 10 elseif((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") OR (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")) 11 target_compile_options(warning_flags INTERFACE 12 -Wall -Wshadow-all -Wshorten-64-to-32 -Wstrict-aliasing -Wuninitialized 13 -Wunused-parameter -Wconversion -Wsign-compare -Wint-conversion 14 -Wconditional-uninitialized -Woverloaded-virtual -Wreorder 15 -Wconstant-conversion -Wsign-conversion -Wunused-private-field 16 -Wbool-conversion -Wno-extra-semi -Wunreachable-code 17 -Wzero-as-null-pointer-constant -Wcast-align 18 -Wno-inconsistent-missing-destructor-override -Wshift-sign-overflow 19 -Wnullable-to-nonnull-conversion -Wno-missing-field-initializers 20 -Wno-ignored-qualifiers -Wpedantic -Wno-pessimizing-move 21 # These lines suppress some custom warnings. 22 # Comment them out to be more strict. 23 -Wno-shadow-field-in-constructor 24 # Supress warnings from xsimd 25 -Wno-cast-align -Wno-shadow -Wno-implicit-int-conversion 26 -Wno-zero-as-null-pointer-constant -Wno-sign-conversion 27 # Needed for ARM processor, OSX versions below 10.14 28 -fno-aligned-allocation 29 ) 30 elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") 31 target_compile_options(warning_flags INTERFACE 32 -Wall -Wextra -Wstrict-aliasing -Wuninitialized -Wunused-parameter 33 -Wsign-compare -Woverloaded-virtual -Wreorder -Wunreachable-code 34 -Wzero-as-null-pointer-constant -Wcast-align -Wno-implicit-fallthrough 35 -Wno-maybe-uninitialized -Wno-missing-field-initializers -Wno-pedantic 36 -Wno-ignored-qualifiers -Wno-unused-function -Wno-pessimizing-move 37 # From LV2 Wrapper 38 -Wno-parentheses -Wno-deprecated-declarations -Wno-redundant-decls 39 # For XSIMD 40 -Wno-zero-as-null-pointer-constant 41 # These lines suppress some custom warnings. 42 # Comment them out to be more strict. 43 -Wno-redundant-move 44 ) 45 46 if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "7.0.0") 47 target_compile_options(warning_flags INTERFACE "-Wno-strict-overflow") 48 endif() 49 endif()