Исправлено разрешение автоматического исправления ошибок для Clang-Tidy
This commit is contained in:
parent
255f0f432b
commit
afa8b1e295
@ -8,22 +8,23 @@ find_program(
|
|||||||
clang-tidy-6.0
|
clang-tidy-6.0
|
||||||
clang-tidy)
|
clang-tidy)
|
||||||
if(CLANG_TIDY_EXE)
|
if(CLANG_TIDY_EXE)
|
||||||
option(CLANG_TIDY_FIX "Perform fixes for Clang-Tidy" OFF)
|
option(CMLIB_CLANG_TIDY_FIX "Perform fixes for Clang-Tidy" OFF)
|
||||||
if(CLANG_TIDY_FIX)
|
|
||||||
list(APPEND _args "-fix")
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
function(add_clang_tidy_check target)
|
function(add_clang_tidy_check target)
|
||||||
set(_sources ${ARGN})
|
set(_sources ${ARGN})
|
||||||
|
set(_args -extra-arg="-Wno-unknown-warning-option")
|
||||||
|
|
||||||
if(CLANG_TIDY_EXE)
|
if(CLANG_TIDY_EXE)
|
||||||
|
if(CMLIB_CLANG_TIDY_FIX)
|
||||||
|
list(APPEND _args "-fix")
|
||||||
|
endif()
|
||||||
if(NOT TARGET clang-tidy-check)
|
if(NOT TARGET clang-tidy-check)
|
||||||
add_custom_target(clang-tidy-check)
|
add_custom_target(clang-tidy-check)
|
||||||
endif()
|
endif()
|
||||||
add_custom_target(
|
add_custom_target(
|
||||||
clang-tidy-check-${target} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
clang-tidy-check-${target} 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} ${_args} -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})
|
add_dependencies(clang-tidy-check clang-tidy-check-${target})
|
||||||
else()
|
else()
|
||||||
|
Loading…
Reference in New Issue
Block a user