From 8c57311bb088036c47c4775df6050055682c6855 Mon Sep 17 00:00:00 2001 From: Andrey Astafyev Date: Fri, 7 Oct 2022 08:03:56 +0300 Subject: [PATCH] 2.0.5 --- MyxxCMake/MyxxCMakeConfig.cmake | 6 +- MyxxCMake/MyxxCMakeConfigVersion.cmake | 2 +- MyxxCMake/lib/AnalyzePvsStudio.cmake | 2 +- MyxxCMake/lib/WarningFlags.cmake | 87 +++++++++++++++++++++++ MyxxCMake/lib/pvs-studio/PVS-Studio.cmake | 1 + VERSION | 2 +- debian/CMakeLists.txt | 2 +- debian/changelog | 2 +- 8 files changed, 98 insertions(+), 6 deletions(-) create mode 100644 MyxxCMake/lib/WarningFlags.cmake diff --git a/MyxxCMake/MyxxCMakeConfig.cmake b/MyxxCMake/MyxxCMakeConfig.cmake index 92f450e..ab0cfce 100644 --- a/MyxxCMake/MyxxCMakeConfig.cmake +++ b/MyxxCMake/MyxxCMakeConfig.cmake @@ -20,6 +20,7 @@ if(IS_DIRECTORY "${MYXX_CMAKE_SANITIZERS_DIR}") endif() find_package(Sanitizers REQUIRED) +include(${MYXX_CMAKE_LIB_DIR}/WarningFlags.cmake) include(${MYXX_CMAKE_LIB_DIR}/Coverage.cmake) include(${MYXX_CMAKE_LIB_DIR}/AnalyzeApplyReplacements.cmake) include(${MYXX_CMAKE_LIB_DIR}/AnalyzeClangTidy.cmake) @@ -40,7 +41,10 @@ function(myxx) get_property(targets DIRECTORY ${CMAKE_BINARY_DIR} PROPERTY BUILDSYSTEM_TARGETS) foreach(iter ${targets}) get_target_property(target_type ${iter} TYPE) - if(NOT ${target_type} STREQUAL "UTILITY") + if((NOT ${target_type} STREQUAL "UTILITY") AND + (NOT ${iter} MATCHES ".*_shared$" ) AND + (NOT ${iter} MATCHES ".*_static$" ) + ) myxx_code_coverage(${iter}) myxx_analyze_clang_tidy(${iter}) myxx_analyze_clang_check(${iter}) diff --git a/MyxxCMake/MyxxCMakeConfigVersion.cmake b/MyxxCMake/MyxxCMakeConfigVersion.cmake index 3361fe0..ab20338 100644 --- a/MyxxCMake/MyxxCMakeConfigVersion.cmake +++ b/MyxxCMake/MyxxCMakeConfigVersion.cmake @@ -1,4 +1,4 @@ -set(MYXX_CMAKE_PACKAGE_VERSION "2.0.4") +set(MYXX_CMAKE_PACKAGE_VERSION "2.0.5") if(MYXX_CMAKE_PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION) set(PACKAGE_VERSION_COMPATIBLE FALSE) else() diff --git a/MyxxCMake/lib/AnalyzePvsStudio.cmake b/MyxxCMake/lib/AnalyzePvsStudio.cmake index a37617b..8ba5e6e 100644 --- a/MyxxCMake/lib/AnalyzePvsStudio.cmake +++ b/MyxxCMake/lib/AnalyzePvsStudio.cmake @@ -35,7 +35,7 @@ function(myxx_analyze_pvs_studio target) endif() pvs_studio_add_target(TARGET ${target}-analyze-pvs-studio - ANALYZE ${target} + ANALYZE ${target} RECURSIVE HIDE_HELP OUTPUT FORMAT errorfile diff --git a/MyxxCMake/lib/WarningFlags.cmake b/MyxxCMake/lib/WarningFlags.cmake new file mode 100644 index 0000000..f756e71 --- /dev/null +++ b/MyxxCMake/lib/WarningFlags.cmake @@ -0,0 +1,87 @@ +include_guard(GLOBAL) + +option(MYX_CMAKE_WARNINGS_NORMAL "Normal level" ON) +cmake_dependent_option(MYX_CMAKE_WARNINGS_VERBOSE "Verbose level" OFF "MYX_CMAKE_WARNINGS_NORMAL" OFF) + +if(MYX_CMAKE_WARNINGS_NORMAL) + if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + check_enable_cxx_compiler_flag(-Wshadow) + check_enable_cxx_compiler_flag(-Wtautological-overlap-compare) + check_enable_cxx_compiler_flag(-Wtautological-compare) + check_enable_cxx_compiler_flag(-Wtautological-bitwise-compare) + check_enable_cxx_compiler_flag(-Wbitwise-conditional-parentheses) + check_enable_cxx_compiler_flag(-Wrange-loop-analysis) + check_enable_cxx_compiler_flag(-Wmisleading-indentation) + check_enable_cxx_compiler_flag(-Wc99-designator) + check_enable_cxx_compiler_flag(-Wreorder-init-list) + check_enable_cxx_compiler_flag(-Wsizeof-pointer-div) + check_enable_cxx_compiler_flag(-Wsizeof-array-div) + check_enable_cxx_compiler_flag(-Wxor-used-as-pow) + check_enable_cxx_compiler_flag(-Wfinal-dtor-non-final-class) + endif() + + if((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") OR + (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")) + check_enable_cxx_compiler_flag(-Wall) + check_enable_cxx_compiler_flag(-Wextra) + check_enable_cxx_compiler_flag(-Wnon-virtual-dtor) + check_enable_cxx_compiler_flag(-Wlogical-op) + check_enable_cxx_compiler_flag(-Wconversion) + check_enable_cxx_compiler_flag(-Wdeprecated) + check_enable_cxx_compiler_flag(-ftemplate-depth=1024) + check_enable_cxx_compiler_flag(-Wold-style-cast) + check_enable_cxx_compiler_flag(-Wdisabled-optimization) + check_enable_cxx_compiler_flag(-ftemplate-backtrace-limit=0) + check_enable_cxx_compiler_flag(-fstack-protector-all) + check_enable_cxx_compiler_flag(-Wodr) + check_enable_cxx_compiler_flag(-Wsuggest-final-types) + check_enable_cxx_compiler_flag(-Wsuggest-final-methods) + check_enable_cxx_compiler_flag(-Wsuggest-override) + check_enable_cxx_compiler_flag(-fdiagnostics-show-template-tree) + + if(NOT MYX_CMAKE_WARNINGS_VERBOSE) + if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "5.999") + check_enable_cxx_compiler_flag(-Wno-attributes) + endif() + check_enable_cxx_compiler_flag(-Wno-maybe-uninitialized) + endif() + endif() + endif() +endif() + +if(MYX_CMAKE_WARNINGS_VERBOSE) + if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + check_enable_cxx_compiler_flag(-Wpointer-to-int-cast) + check_enable_cxx_compiler_flag(-Wuninitialized-const-reference) + check_enable_cxx_compiler_flag(-Wunused-but-set-parameter) + check_enable_cxx_compiler_flag(-Wunused-but-set-variable) + check_enable_cxx_compiler_flag(-Wnull-pointer-subtraction) + check_enable_cxx_compiler_flag(-Wno-reserved-identifier) + endif() + + if((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") OR + (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")) + check_enable_cxx_compiler_flag(-Wshadow) + check_enable_cxx_compiler_flag(-Wpedantic) + check_enable_cxx_compiler_flag(-Wnoexcept) + check_enable_cxx_compiler_flag(-Wzero-as-null-pointer-constant) + # From GCC 6. + check_enable_cxx_compiler_flag(-Wshift-negative-value) + check_enable_cxx_compiler_flag(-Wshift-overflow=2) + check_enable_cxx_compiler_flag(-Wduplicated-cond) + check_enable_cxx_compiler_flag(-Wnull-dereference) + # From GCC 7. + check_enable_cxx_compiler_flag(-Wduplicated-branches) + check_enable_cxx_compiler_flag(-Wrestrict) + check_enable_cxx_compiler_flag(-Waligned-new) + # From GCC 8. + check_enable_cxx_compiler_flag(-Wcast-align=strict) + # From GCC 10. + check_enable_cxx_compiler_flag(-Wmismatched-tags) + check_enable_cxx_compiler_flag(-Wredundant-tags) + # From GCC 12. + check_enable_cxx_compiler_flag(-Warray-compare) + check_enable_cxx_compiler_flag(-Wmissing-requires) + endif() +endif() diff --git a/MyxxCMake/lib/pvs-studio/PVS-Studio.cmake b/MyxxCMake/lib/pvs-studio/PVS-Studio.cmake index 6ca32b0..c294605 100644 --- a/MyxxCMake/lib/pvs-studio/PVS-Studio.cmake +++ b/MyxxCMake/lib/pvs-studio/PVS-Studio.cmake @@ -4,6 +4,7 @@ # Version 12 cmake_minimum_required(VERSION 3.0.0) +cmake_policy(SET CMP0051 NEW) cmake_policy(SET CMP0054 NEW) if (PVS_STUDIO_AS_SCRIPT) diff --git a/VERSION b/VERSION index 2165f8f..e010258 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.0.4 +2.0.5 diff --git a/debian/CMakeLists.txt b/debian/CMakeLists.txt index 611eca5..2ce6744 100644 --- a/debian/CMakeLists.txt +++ b/debian/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.6 FATAL_ERROR) -project(myxx-cmake VERSION 2.0.4 LANGUAGES) +project(myxx-cmake VERSION 2.0.5 LANGUAGES) include(GNUInstallDirs) file(WRITE ${CMAKE_SOURCE_DIR}/MyxxCMake/MyxxCMakeConfigVersion.cmake diff --git a/debian/changelog b/debian/changelog index 071b49f..568c682 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -myxx-cmake (2.0.4) unstable; urgency=medium +myxx-cmake (2.0.5) unstable; urgency=medium * New version.