Общие цели для проверок кода и работы с переводами

This commit is contained in:
Andrei Astafev 2019-06-27 05:18:29 +03:00
parent d8541fc081
commit 22afe7b94c
4 changed files with 16 additions and 0 deletions

View File

@ -10,10 +10,14 @@ function(add_clang_tidy_check)
if(CLANG_TIDY_FIX) if(CLANG_TIDY_FIX)
list(APPEND _args "-fix") list(APPEND _args "-fix")
endif() endif()
if(NOT TARGET clang-tidy-check)
add_custom_target(clang-tidy-check)
endif()
add_custom_target(clang-tidy-check-${_target} add_custom_target(clang-tidy-check-${_target}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND ${CLANG_TIDY_EXE} -extra-arg="-Wno-unknown-warning-option" -p ${CMAKE_BINARY_DIR} ${_sources}) COMMAND ${CLANG_TIDY_EXE} -extra-arg="-Wno-unknown-warning-option" -p ${CMAKE_BINARY_DIR} ${_sources})
add_dependencies(clang-tidy-check-${_target} ${_target}) add_dependencies(clang-tidy-check-${_target} ${_target})
add_dependencies(clang-tidy-check clang-tidy-check-${_target})
else() else()
message(WARNING "ClangTidy is not found") message(WARNING "ClangTidy is not found")
endif() endif()

View File

@ -6,10 +6,14 @@ function(add_clazy_check)
find_program(CLAZY_EXE find_program(CLAZY_EXE
NAMES clazy-standalone) NAMES clazy-standalone)
if(CLAZY_EXE) if(CLAZY_EXE)
if(NOT TARGET clazy-check)
add_custom_target(clazy-check)
endif()
add_custom_target(clazy-check-${_target} add_custom_target(clazy-check-${_target}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND ${CLAZY_EXE} -checks=level2 -extra-arg="-Wno-unknown-warning-option" -p ${CMAKE_BINARY_DIR} ${_sources}) COMMAND ${CLAZY_EXE} -checks=level2 -extra-arg="-Wno-unknown-warning-option" -p ${CMAKE_BINARY_DIR} ${_sources})
add_dependencies(clazy-check-${_target} ${_target}) add_dependencies(clazy-check-${_target} ${_target})
add_dependencies(clazy-check clazy-check-${_target})
else() else()
message(WARNING "Clazy is not found") message(WARNING "Clazy is not found")
endif() endif()

View File

@ -5,6 +5,9 @@ function(add_pvs_check)
include(PVS-Studio) include(PVS-Studio)
find_program(PVS_STUDIO_ANALYZER_EXE NAMES pvs-studio-analyzer) find_program(PVS_STUDIO_ANALYZER_EXE NAMES pvs-studio-analyzer)
if(PVS_STUDIO_ANALYZER_EXE) if(PVS_STUDIO_ANALYZER_EXE)
if(NOT TARGET pvs-check)
add_custom_target(pvs-check)
endif()
pvs_studio_add_target(TARGET pvs-check-${_target} pvs_studio_add_target(TARGET pvs-check-${_target}
DEPENDS ${_target} DEPENDS ${_target}
COMPILE_COMMANDS COMPILE_COMMANDS
@ -13,6 +16,7 @@ function(add_pvs_check)
CONFIG "${CMAKE_BINARY_DIR}/PVS-Studio-${_target}.cfg" CONFIG "${CMAKE_BINARY_DIR}/PVS-Studio-${_target}.cfg"
CFG_TEXT "analysis-mode=29" CFG_TEXT "analysis-mode=29"
MODE GA:1,2,3;64:1;OP:1,2;CS:1,2) MODE GA:1,2,3;64:1;OP:1,2;CS:1,2)
add_dependencies(pvs-check pvs-check-${_target})
else() else()
message(WARNING "PVS-Studio is not found") message(WARNING "PVS-Studio is not found")
endif() endif()

View File

@ -48,6 +48,10 @@ function(qt_translation)
qt5_add_resources(_qrc ${CMAKE_BINARY_DIR}/${_target}_l10n.qrc) qt5_add_resources(_qrc ${CMAKE_BINARY_DIR}/${_target}_l10n.qrc)
add_custom_target(${_target}_qrc DEPENDS ${_qrc}) add_custom_target(${_target}_qrc DEPENDS ${_qrc})
add_custom_target(${_target}_l10n DEPENDS ${_l10n_targets}) add_custom_target(${_target}_l10n DEPENDS ${_l10n_targets})
if(NOT TARGET l10n)
add_custom_target(l10n)
endif()
add_dependencies(l10n ${_target}_l10n)
add_dependencies(${_target} ${_target}_qrc) add_dependencies(${_target} ${_target}_qrc)
target_sources(${_target} PUBLIC ${_qrc}) target_sources(${_target} PUBLIC ${_qrc})