Compare commits

...

5 Commits

Author SHA1 Message Date
54f8cfc1cc 2.0.9 2022-10-09 21:15:35 +03:00
fe4129114c 2.0.8 2022-10-08 19:49:54 +03:00
7c5bef2913 2.0.7 2022-10-08 17:25:50 +03:00
0f2d983a15 2.0.6 2022-10-07 11:22:07 +03:00
8c57311bb0 2.0.5 2022-10-07 08:03:56 +03:00
14 changed files with 200 additions and 77 deletions

View File

@ -6,6 +6,9 @@ DEB_DIR:=$(BUILD_DIR)/deb/myxx-cmake-$(V)
all: v deb pack all: v deb pack
v: v:
sed -i "s/\/[0-9][0-9.]\+/\/$V/g" $(TOP_DIR)/README.md
sed -i "s/[0-9][0-9.]\+tar/$V.tar/g" $(TOP_DIR)/README.md
sed -i "s/[0-9][0-9.]\+_all/$(V)_all/g" $(TOP_DIR)/README.md
sed -i "s/CMake.*REQUIRED/CMake $V REQUIRED/" $(TOP_DIR)/README.md sed -i "s/CMake.*REQUIRED/CMake $V REQUIRED/" $(TOP_DIR)/README.md
sed -i "s/VERSION \".*\"/VERSION \"$V\"/" $(TOP_DIR)/MyxxCMake/MyxxCMakeConfigVersion.cmake sed -i "s/VERSION \".*\"/VERSION \"$V\"/" $(TOP_DIR)/MyxxCMake/MyxxCMakeConfigVersion.cmake
sed -i "s/VERSION .* LANG/VERSION $V LANG/" $(TOP_DIR)/debian/CMakeLists.txt sed -i "s/VERSION .* LANG/VERSION $V LANG/" $(TOP_DIR)/debian/CMakeLists.txt

View File

@ -20,6 +20,7 @@ if(IS_DIRECTORY "${MYXX_CMAKE_SANITIZERS_DIR}")
endif() endif()
find_package(Sanitizers REQUIRED) find_package(Sanitizers REQUIRED)
include(${MYXX_CMAKE_LIB_DIR}/WarningFlags.cmake)
include(${MYXX_CMAKE_LIB_DIR}/Coverage.cmake) include(${MYXX_CMAKE_LIB_DIR}/Coverage.cmake)
include(${MYXX_CMAKE_LIB_DIR}/AnalyzeApplyReplacements.cmake) include(${MYXX_CMAKE_LIB_DIR}/AnalyzeApplyReplacements.cmake)
include(${MYXX_CMAKE_LIB_DIR}/AnalyzeClangTidy.cmake) include(${MYXX_CMAKE_LIB_DIR}/AnalyzeClangTidy.cmake)
@ -40,11 +41,18 @@ function(myxx)
get_property(targets DIRECTORY ${CMAKE_BINARY_DIR} PROPERTY BUILDSYSTEM_TARGETS) get_property(targets DIRECTORY ${CMAKE_BINARY_DIR} PROPERTY BUILDSYSTEM_TARGETS)
foreach(iter ${targets}) foreach(iter ${targets})
get_target_property(target_type ${iter} TYPE) 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_code_coverage(${iter})
myxx_analyze_clang_tidy(${iter}) myxx_analyze_clang_tidy(${iter})
myxx_analyze_clang_check(${iter}) myxx_analyze_clang_check(${iter})
if(MYXX_CMAKE_CLAZY_FIX)
myxx_analyze_clazy(${iter} FIX)
else()
myxx_analyze_clazy(${iter}) myxx_analyze_clazy(${iter})
endif()
myxx_analyze_pvs_studio(${iter}) myxx_analyze_pvs_studio(${iter})
myxx_add_sanitizers(${iter}) myxx_add_sanitizers(${iter})
endif() endif()

View File

@ -1,4 +1,4 @@
set(MYXX_CMAKE_PACKAGE_VERSION "2.0.4") set(MYXX_CMAKE_PACKAGE_VERSION "2.0.9")
if(MYXX_CMAKE_PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION) if(MYXX_CMAKE_PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
set(PACKAGE_VERSION_COMPATIBLE FALSE) set(PACKAGE_VERSION_COMPATIBLE FALSE)
else() else()

View File

@ -13,14 +13,16 @@ endif()
find_program(CLANG_CHECK_EXE NAMES ${CLANG_CHECK_NAMES}) find_program(CLANG_CHECK_EXE NAMES ${CLANG_CHECK_NAMES})
unset(CLANG_CHECK_NAMES) unset(CLANG_CHECK_NAMES)
function(myxx_analyze_clang_check target) function(myxx_analyze_clang_check TARGET_NAME)
myx_skip_external_target(${TARGET_NAME})
if(NOT CLANG_CHECK_EXE) if(NOT CLANG_CHECK_EXE)
message(STATUS "MyxCMake: Clang Check analyzer is not found") message(STATUS "MyxCMake: Clang Check analyzer is not found")
return() return()
endif() endif()
if(TARGET ${target}-analyze-clang-check) if(TARGET ${TARGET_NAME}-analyze-clang-check)
message(STATUS "MyxxCMake: target ${target}-analyze-clang-check already exists") message(STATUS "MyxxCMake: target ${TARGET_NAME}-analyze-clang-check already exists")
return() return()
endif() endif()
@ -29,24 +31,24 @@ function(myxx_analyze_clang_check target)
set(multiValueArgs EXTRA_ARGS) set(multiValueArgs EXTRA_ARGS)
cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
set(args --analyze --extra-arg=-Wno-unknown-warning-option ${EXTRA_ARGS}) set(__cmd_args --analyze --extra-arg=-Wno-unknown-warning-option ${EXTRA_ARGS})
get_target_property(sources ${target} SOURCES) get_target_property(__sources ${TARGET_NAME} SOURCES)
foreach(iter ${sources}) foreach(iter ${__sources})
string(FIND ${iter} ${CMAKE_BINARY_DIR} pos) string(FIND ${iter} ${CMAKE_BINARY_DIR} pos)
if(pos EQUAL -1) if(pos EQUAL -1)
list(APPEND srcs ${iter}) list(APPEND __filtered_sources ${iter})
endif() endif()
endforeach() endforeach()
if(ARG_FIX) if(ARG_FIX)
list(APPEND args "--fixit") list(APPEND __cmd_args "--fixit")
endif() endif()
if(NOT TARGET myxx-analyze-clang-check) if(NOT TARGET myxx-analyze-clang-check)
add_custom_target(myxx-analyze-clang-check) add_custom_target(myxx-analyze-clang-check)
endif() endif()
add_custom_target(${target}-analyze-clang-check add_custom_target(${TARGET_NAME}-analyze-clang-check
WORKING_DIRECTORY ${CMAKE_BINARY_DIR} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMAND ${CLANG_CHECK_EXE} ${args} -p ${CMAKE_BINARY_DIR} ${srcs}) COMMAND ${CLANG_CHECK_EXE} ${__cmd_args} -p ${CMAKE_BINARY_DIR} ${__filtered_sources})
add_dependencies(${target}-analyze-clang-check ${target}) add_dependencies(${TARGET_NAME}-analyze-clang-check ${TARGET_NAME})
add_dependencies(myxx-analyze-clang-check ${target}-analyze-clang-check) add_dependencies(myxx-analyze-clang-check ${TARGET_NAME}-analyze-clang-check)
endfunction() endfunction()

View File

@ -13,14 +13,16 @@ endif()
find_program(CLANG_TIDY_EXE NAMES ${CLANG_TIDY_NAMES}) find_program(CLANG_TIDY_EXE NAMES ${CLANG_TIDY_NAMES})
unset(CLANG_TIDY_NAMES) unset(CLANG_TIDY_NAMES)
function(myxx_analyze_clang_tidy target) function(myxx_analyze_clang_tidy TARGET_NAME)
myx_skip_external_target(${TARGET_NAME})
if(NOT CLANG_TIDY_EXE) if(NOT CLANG_TIDY_EXE)
message(STATUS "MyxxCMake: Clang Tidy analyzer is not found") message(STATUS "MyxxCMake: Clang Tidy analyzer is not found")
return() return()
endif() endif()
if(TARGET ${target}-analyze-clang-tidy) if(TARGET ${TARGET_NAME}-analyze-clang-tidy)
message(STATUS "MyxxCMake: target ${target}-analyze-clang-tidy already exists") message(STATUS "MyxxCMake: target ${TARGET_NAME}-analyze-clang-tidy already exists")
return() return()
endif() endif()
@ -29,24 +31,24 @@ function(myxx_analyze_clang_tidy target)
set(multiValueArgs EXTRA_ARGS) set(multiValueArgs EXTRA_ARGS)
cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
set(args -extra-arg="-Wno-unknown-warning-option ${ARG_EXTRA_ARGS}") set(__cmd_args -extra-arg="-Wno-unknown-warning-option ${ARG_EXTRA_ARGS}")
get_target_property(sources ${target} SOURCES) get_target_property(__sources ${TARGET_NAME} SOURCES)
foreach(iter ${sources}) foreach(iter ${__sources})
string(FIND ${iter} ${CMAKE_BINARY_DIR} pos) string(FIND ${iter} ${CMAKE_BINARY_DIR} pos)
if(pos EQUAL -1) if(pos EQUAL -1)
list(APPEND srcs ${iter}) list(APPEND __filtered_sources ${iter})
endif() endif()
endforeach() endforeach()
if(ARG_FIX) if(ARG_FIX)
list(APPEND args "-fix-errors") list(APPEND __cmd_args "-fix-errors")
endif() endif()
if(NOT TARGET myxx-analyze-clang-tidy) if(NOT TARGET myxx-analyze-clang-tidy)
add_custom_target(myxx-analyze-clang-tidy) add_custom_target(myxx-analyze-clang-tidy)
endif() endif()
add_custom_target(${target}-analyze-clang-tidy add_custom_target(${TARGET_NAME}-analyze-clang-tidy
WORKING_DIRECTORY ${CMAKE_BINARY_DIR} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMAND ${CLANG_TIDY_EXE} ${args} -p ${CMAKE_BINARY_DIR} ${srcs}) COMMAND ${CLANG_TIDY_EXE} ${__cmd_args} -p ${CMAKE_BINARY_DIR} ${__filtered_sources})
add_dependencies(${target}-analyze-clang-tidy ${target}) add_dependencies(${TARGET_NAME}-analyze-clang-tidy ${TARGET_NAME})
add_dependencies(myxx-analyze-clang-tidy ${target}-analyze-clang-tidy) add_dependencies(myxx-analyze-clang-tidy ${TARGET_NAME}-analyze-clang-tidy)
endfunction() endfunction()

View File

@ -6,14 +6,16 @@ if(CLAZY_EXE AND CLANG_APPLY_REPLACEMENTS_EXE)
option(MYXX_CMAKE_CLAZY_FIX "MyxCMake: perform fixes for Clazy" OFF) option(MYXX_CMAKE_CLAZY_FIX "MyxCMake: perform fixes for Clazy" OFF)
endif() endif()
function(myxx_analyze_clazy target) function(myxx_analyze_clazy TARGET_NAME)
myx_skip_external_target(${TARGET_NAME})
if(NOT CLAZY_EXE) if(NOT CLAZY_EXE)
message(STATUS "MyxCMake: Clazy standalone analyzer is not found") message(STATUS "MyxCMake: Clazy standalone analyzer is not found")
return() return()
endif() endif()
if(TARGET ${target}-analyze-clazy) if(TARGET ${TARGET_NAME}-analyze-clazy)
message(STATUS "MyxxCMake: target ${target}-analyze-clazy already exists") message(STATUS "MyxxCMake: target ${TARGET_NAME}-analyze-clazy already exists")
return() return()
endif() endif()
@ -23,17 +25,21 @@ function(myxx_analyze_clazy target)
cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
if(NOT ARG_CHECKS) if(NOT ARG_CHECKS)
set(ARG_CHECKS "level2,container-inside-loop,heap-allocated-small-trivial-type,inefficient-qlist,isempty-vs-count,qt-keywords,unneeded-cast") set(ARG_CHECKS
"level2,container-inside-loop,detaching-member,heap-allocated-small-trivial-type,\
isempty-vs-count,qproperty-type-mismatch,qstring-varargs,qt6-deprecated-api-fixes,\
qt6-fwd-fixes,qt6-qlatin1stringchar-to-u,qt-keywords,signal-with-return-value,\
thread-with-slots,tr-non-literal,unneeded-cast,use-chrono-in-qtimer")
endif() endif()
set(args -checks=${ARG_CHECKS} set(__cmd_args -checks=${ARG_CHECKS}
-extra-arg=-Wno-unknown-warning-option -extra-arg=-Wno-unknown-warning-option
-export-fixes=clazy-fixes-file.yaml) -export-fixes=clazy-fixes-file.yaml)
get_target_property(sources ${target} SOURCES) get_target_property(__sources ${TARGET_NAME} SOURCES)
foreach(iter ${sources}) foreach(iter ${__sources})
string(FIND ${iter} ${CMAKE_BINARY_DIR} pos) string(FIND ${iter} ${CMAKE_BINARY_DIR} pos)
if(pos EQUAL -1) if(pos EQUAL -1)
list(APPEND srcs ${iter}) list(APPEND __filtered_sources ${iter})
endif() endif()
endforeach() endforeach()
@ -42,15 +48,15 @@ function(myxx_analyze_clazy target)
endif() endif()
if(ARG_FIX) if(ARG_FIX)
add_custom_target(${target}-analyze-clazy add_custom_target(${TARGET_NAME}-analyze-clazy
WORKING_DIRECTORY ${CMAKE_BINARY_DIR} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMAND ${CLAZY_EXE} ${args} -p ${CMAKE_BINARY_DIR} ${srcs} COMMAND ${CLAZY_EXE} ${__cmd_args} -p ${CMAKE_BINARY_DIR} ${__filtered_sources}
COMMAND ${CLANG_APPLY_REPLACEMENTS_EXE} ${CMAKE_BINARY_DIR}) COMMAND ${CLANG_APPLY_REPLACEMENTS_EXE} ${CMAKE_BINARY_DIR})
else() else()
add_custom_target(${target}-analyze-clazy add_custom_target(${TARGET_NAME}-analyze-clazy
WORKING_DIRECTORY ${CMAKE_BINARY_DIR} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMAND ${CLAZY_EXE} ${args} -p ${CMAKE_BINARY_DIR} ${srcs}) COMMAND ${CLAZY_EXE} ${__cmd_args} -p ${CMAKE_BINARY_DIR} ${__filtered_sources})
endif() endif()
add_dependencies(${target}-analyze-clazy ${target}) add_dependencies(${TARGET_NAME}-analyze-clazy ${TARGET_NAME})
add_dependencies(myxx-analyze-clazy ${target}-analyze-clazy) add_dependencies(myxx-analyze-clazy ${TARGET_NAME}-analyze-clazy)
endfunction() endfunction()

View File

@ -5,10 +5,13 @@ if(${CMAKE_VERSION} VERSION_LESS "3.17.0")
set(MYXX_CMAKE_LIB_PVS_DIR_BACKPORT ${CMAKE_CURRENT_LIST_DIR}) set(MYXX_CMAKE_LIB_PVS_DIR_BACKPORT ${CMAKE_CURRENT_LIST_DIR})
endif() endif()
function(myxx_analyze_pvs_studio target) function(myxx_analyze_pvs_studio TARGET_NAME)
if(${CMAKE_VERSION} VERSION_LESS "3.17.0") if(${CMAKE_VERSION} VERSION_LESS "3.17.0")
set(CMAKE_CURRENT_FUNCTION_LIST_DIR ${MYXX_CMAKE_LIB_PVS_DIR_BACKPORT}) set(CMAKE_CURRENT_FUNCTION_LIST_DIR ${MYXX_CMAKE_LIB_PVS_DIR_BACKPORT})
endif() endif()
myx_skip_external_target(${TARGET_NAME})
if(NOT PVS_STUDIO_ANALYZER_EXE) if(NOT PVS_STUDIO_ANALYZER_EXE)
message(STATUS "MyxxCMake: pvs-studio-analyzer not found.") message(STATUS "MyxxCMake: pvs-studio-analyzer not found.")
return() return()
@ -31,29 +34,38 @@ function(myxx_analyze_pvs_studio target)
endif() endif()
if(NOT ARG_MODE) if(NOT ARG_MODE)
set(ARG_MODE "GA:1,2,3;64:1,2,3;OP:1,2,3;CS:1,2,3;OWASP:1,2,3") set(ARG_MODE "GA:1,2,3;64:1,2;OP:1,2,3;CS:1,2;OWASP:1,2")
endif() endif()
pvs_studio_add_target(TARGET ${target}-analyze-pvs-studio get_target_property(sources ${TARGET_NAME} SOURCES)
ANALYZE ${target} foreach(iter ${sources})
string(FIND ${iter} ${CMAKE_BINARY_DIR} pos)
if(pos EQUAL -1)
list(APPEND srcs ${iter})
endif()
endforeach()
pvs_studio_add_target(TARGET ${TARGET_NAME}-analyze-pvs-studio
ANALYZE ${TARGET_NAME}
COMPILE_COMMANDS
HIDE_HELP HIDE_HELP
OUTPUT OUTPUT
FORMAT errorfile FORMAT errorfile
ARGS --exclude-path ${CMAKE_CURRENT_BINARY_DIR} ${ARG_ARGS} ARGS --exclude-path ${CMAKE_CURRENT_BINARY_DIR} ${ARG_ARGS}
MODE ${ARG_MODE}) MODE ${ARG_MODE})
get_target_property(target_type ${target} TYPE) get_target_property(__target_type ${TARGET_NAME} TYPE)
if(${target_type} STREQUAL INTERFACE_LIBRARY) if(${__target_type} STREQUAL INTERFACE_LIBRARY)
set(target_type INTERFACE) set(__target_type INTERFACE)
else() else()
set(target_type PRIVATE) set(__target_type PRIVATE)
endif() endif()
if(MSVC) if(MSVC)
target_compile_options(${target} BEFORE ${target_type} /FI ${ARG_HEADER}) target_compile_options(${TARGET_NAME} BEFORE ${__target_type} /FI ${ARG_HEADER})
else() # GCC/Clang else() # GCC/Clang
target_compile_options(${target} BEFORE ${target_type} -include ${ARG_HEADER}) target_compile_options(${TARGET_NAME} BEFORE ${__target_type} -include ${ARG_HEADER})
endif() endif()
add_dependencies(${target}-analyze-pvs-studio ${target}) add_dependencies(${TARGET_NAME}-analyze-pvs-studio ${TARGET_NAME})
add_dependencies(myxx-analyze-pvs-studio ${target}-analyze-pvs-studio) add_dependencies(myxx-analyze-pvs-studio ${TARGET_NAME}-analyze-pvs-studio)
endfunction() endfunction()

View File

@ -5,10 +5,11 @@ if(MYXX_CODE_COVERAGE)
find_program(GENHTML_EXE NAMES genhtml) find_program(GENHTML_EXE NAMES genhtml)
endif() endif()
function(myxx_code_coverage target) function(myxx_code_coverage TARGET_NAME)
if(NOT MYXX_CODE_COVERAGE) if(NOT MYXX_CODE_COVERAGE)
return() return()
endif() endif()
myx_skip_external_target(${TARGET_NAME})
set(options) set(options)
set(oneValueArgs) set(oneValueArgs)
@ -16,33 +17,33 @@ function(myxx_code_coverage target)
cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set_property(TARGET ${target} APPEND PROPERTY set_property(TARGET ${TARGET_NAME} APPEND PROPERTY
COMPILE_OPTIONS --coverage) COMPILE_OPTIONS --coverage)
set_property(TARGET ${target} APPEND PROPERTY LINK_FLAGS --coverage) set_property(TARGET ${TARGET_NAME} APPEND PROPERTY LINK_FLAGS --coverage)
endif() endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set_property(TARGET ${target} APPEND PROPERTY set_property(TARGET ${TARGET_NAME} APPEND PROPERTY
COMPILE_OPTIONS -fprofile-instr-generate -fcoverage-mapping) COMPILE_OPTIONS -fprofile-instr-generate -fcoverage-mapping)
set_property(TARGET ${target} APPEND PROPERTY LINK_FLAGS --coverage) set_property(TARGET ${TARGET_NAME} APPEND PROPERTY LINK_FLAGS --coverage)
endif() endif()
if(LCOV_EXE) if(LCOV_EXE)
add_custom_target(${target}-coverage add_custom_target(${TARGET_NAME}-coverage
WORKING_DIRECTORY ${CMAKE_BINARY_DIR} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMAND ${LCOV_EXE} --test-name ${target} --output "${target}.lcov" COMMAND ${LCOV_EXE} --test-name ${TARGET_NAME} --output "${TARGET_NAME}.lcov"
--capture --capture
--no-external --no-external
--base-directory ${CMAKE_SOURCE_DIR} --base-directory ${CMAKE_SOURCE_DIR}
--directory ${CMAKE_BINARY_DIR} --directory ${CMAKE_BINARY_DIR}
--exclude "/usr/\\\*" --exclude "/usr/\\\*"
--exclude "${CMAKE_BINARY_DIR}/\\\*") --exclude "${CMAKE_BINARY_DIR}/\\\*")
add_dependencies(${target}-coverage ${target}) add_dependencies(${TARGET_NAME}-coverage ${TARGET_NAME})
if(GENHTML_EXE) if(GENHTML_EXE)
add_custom_target(${target}-coverage-report add_custom_target(${TARGET_NAME}-coverage-report
WORKING_DIRECTORY ${CMAKE_BINARY_DIR} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMAND ${GENHTML_EXE} --output-directory "${target}-coverage-html" "${target}.lcov") COMMAND ${GENHTML_EXE} --output-directory "${TARGET_NAME}-coverage-html" "${TARGET_NAME}.lcov")
add_dependencies(${target}-coverage-report ${target}-coverage) add_dependencies(${TARGET_NAME}-coverage-report ${TARGET_NAME}-coverage)
endif() endif()
endif() endif()
endfunction() endfunction()

View File

@ -0,0 +1,88 @@
include_guard(GLOBAL)
option(MYXX_CMAKE_WARNINGS_NORMAL "Normal level" ON)
cmake_dependent_option(MYXX_CMAKE_WARNINGS_VERBOSE "Verbose level" OFF "MYXX_CMAKE_WARNINGS_NORMAL" OFF)
if(MYXX_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 MYXX_CMAKE_WARNINGS_VERBOSE)
check_enable_cxx_compiler_flag(-Wno-float-conversion)
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(MYXX_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()

View File

@ -4,6 +4,7 @@
# Version 12 # Version 12
cmake_minimum_required(VERSION 3.0.0) cmake_minimum_required(VERSION 3.0.0)
cmake_policy(SET CMP0051 NEW)
cmake_policy(SET CMP0054 NEW) cmake_policy(SET CMP0054 NEW)
if (PVS_STUDIO_AS_SCRIPT) if (PVS_STUDIO_AS_SCRIPT)

View File

@ -1,19 +1,19 @@
# Библиотека дополнительных функций для CMake # Библиотека дополнительных функций для сопровождения проекта на CMake
## Установка ## Установка
Скачать [здесь](../../../releases) пакет для Debian и установить Скачать [пакет](../../../releases/download/2.0.9/myxx-cmake_2.0.9_all.deb)
его или архив `myxx-cmake-local` и распаковать его в каталог для Debian и установить его, выполнив команду `sudo dpkg -i myxx-cmake_2.0.9_all.deb`,
`$HOME/.local/share/cmake`. или [архив](../../../releases/download/2.0.9/myxx-cmake-local-2.0.9.tar.xz)
и распаковать его в каталог `$HOME/.local/share/cmake`.
## Использование ## Использование
Для работы в программном проекте должна использоваться библиотека Для работы в программном проекте должна использоваться библиотека
[myx-cmake](../../../../myx), которая автоматически находит [myx-cmake](../../../../myx), которая автоматически находит эту библиотеку.
эту библиотеку.
Для подключения функций необходимо в конце описания проекта Для подключения функций библиотеки необходимо в конце описания
(после создания целей, для которых нужно применить правила) проекта (после создания целей, для которых нужно применить правила)
добавить строки: добавить строки:
```cmake ```cmake

View File

@ -1 +1 @@
2.0.4 2.0.9

View File

@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.6 FATAL_ERROR) cmake_minimum_required(VERSION 3.6 FATAL_ERROR)
project(myxx-cmake VERSION 2.0.4 LANGUAGES) project(myxx-cmake VERSION 2.0.9 LANGUAGES)
include(GNUInstallDirs) include(GNUInstallDirs)
file(WRITE ${CMAKE_SOURCE_DIR}/MyxxCMake/MyxxCMakeConfigVersion.cmake file(WRITE ${CMAKE_SOURCE_DIR}/MyxxCMake/MyxxCMakeConfigVersion.cmake

2
debian/changelog vendored
View File

@ -1,4 +1,4 @@
myxx-cmake (2.0.4) unstable; urgency=medium myxx-cmake (2.0.9) unstable; urgency=medium
* New version. * New version.