Рефакторинг

This commit is contained in:
Andrei Astafev 2021-12-20 14:33:14 +03:00
parent 353d92da23
commit de837bf115
5 changed files with 12 additions and 15 deletions

View File

@ -0,0 +1,8 @@
set(CLANG_APPLY_REPLACEMENTS_NAMES clang-apply-replacements)
foreach(V RANGE 9 15)
list(INSERT CLANG_APPLY_REPLACEMENTS_NAMES 0 "clang-apply-replacements-${V}")
endforeach()
unset(V)
find_program(CLANG_APPLY_REPLACEMENTS_EXE NAMES ${CLANG_APPLY_REPLACEMENTS_NAMES})
unset(CLANG_APPLY_REPLACEMENTS_NAMES)

View File

@ -2,12 +2,12 @@ set(CLANG_CHECK_NAMES clang-check)
foreach(V RANGE 9 15)
list(INSERT CLANG_CHECK_NAMES 0 "clang-check-${V}")
endforeach()
unset(V)
find_program(CLANG_CHECK_EXE NAMES ${CLANG_CHECK_NAMES})
if(CLANG_CHECK_EXE)
option(MYX_CMAKE_CLANG_CHECK_FIX "MyxCMake: perform fixes for Clang Check" OFF)
endif()
unset(V)
unset(CLANG_CHECK_NAMES)
function(myx_cmake_analyze_clang_check target)
@ -18,7 +18,7 @@ function(myx_cmake_analyze_clang_check target)
list(FILTER __sources EXCLUDE REGEX "moc_.*\\.cpp$")
list(FILTER __sources EXCLUDE REGEX "ui_.*\\.h$")
if(MYX_CMAKE_CLANG_ANALYZE_FIX)
if(MYX_CMAKE_CLANG_CHECK_FIX)
list(APPEND _args "--fixit")
endif()
if(NOT TARGET myx-cmake-analyze-clang-check)

View File

@ -2,12 +2,12 @@ set(CLANG_TIDY_NAMES clang-tidy)
foreach(V RANGE 9 15)
list(INSERT CLANG_TIDY_NAMES 0 "clang-tidy-${V}")
endforeach()
unset(V)
find_program(CLANG_TIDY_EXE NAMES ${CLANG_TIDY_NAMES})
if(CLANG_TIDY_EXE)
option(MYX_CMAKE_CLANG_TIDY_FIX "MyxCMake: perform fixes for Clang Tidy" OFF)
endif()
unset(V)
unset(CLANG_TIDY_NAMES)
function(myx_cmake_analyze_clang_tidy target)

View File

@ -1,17 +1,5 @@
find_program(CLAZY_EXE NAMES clazy-standalone)
set(CLANG_APPLY_REPLACEMENTS_NAMES clang-apply-replacements)
foreach(V RANGE 9 15)
list(INSERT CLANG_APPLY_REPLACEMENTS_NAMES 0 "clang-apply-replacements-${V}")
endforeach()
find_program(CLANG_APPLY_REPLACEMENTS_EXE NAMES ${CLANG_APPLY_REPLACEMENTS_NAMES})
if(CLANG_TIDY_EXE)
option(MYX_CMAKE_CLANG_TIDY_FIX "MyxCMake: perform fixes for Clang Tidy" OFF)
endif()
unset(V)
unset(CLANG_TIDY_NAMES)
if(CLAZY_EXE AND CLANG_APPLY_REPLACEMENTS_EXE)
option(MYX_CMAKE_CLAZY_FIX "MyxCMake: perform fixes for Clazy" OFF)
endif()

View File

@ -22,6 +22,7 @@ include(MyxCMakePrecompiledHeaders)
include(MyxCMakeBuildTypes)
include(MyxCMakeDebugOutputOptions)
include(MyxCMakeCodeAnalyzeApplyReplacements)
include(MyxCMakeCodeAnalyzeClangCheck)
include(MyxCMakeCodeAnalyzeClangTidy)
include(MyxCMakeCodeAnalyzeClazy)