modificat cmake amb clang-tidy
This commit is contained in:
@@ -99,6 +99,7 @@ set_target_properties(${PROJECT_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAK
|
||||
# --- STATIC ANALYSIS TARGETS ---
|
||||
# Buscar herramientas de análisis estático
|
||||
find_program(CLANG_FORMAT_EXE NAMES clang-format)
|
||||
find_program(CLANG_TIDY_EXE NAMES clang-tidy)
|
||||
|
||||
# Recopilar todos los archivos fuente para formateo
|
||||
file(GLOB_RECURSE ALL_SOURCE_FILES
|
||||
@@ -127,3 +128,27 @@ if(CLANG_FORMAT_EXE)
|
||||
else()
|
||||
message(STATUS "clang-format no encontrado - targets 'format' y 'format-check' no disponibles")
|
||||
endif()
|
||||
|
||||
# Targets de clang-tidy
|
||||
if(CLANG_TIDY_EXE)
|
||||
add_custom_target(tidy
|
||||
COMMAND ${CLANG_TIDY_EXE}
|
||||
-p ${CMAKE_BINARY_DIR}
|
||||
--fix
|
||||
--fix-errors
|
||||
${ALL_SOURCE_FILES}
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
COMMENT "Running clang-tidy with auto-fix..."
|
||||
)
|
||||
|
||||
add_custom_target(tidy-check
|
||||
COMMAND ${CLANG_TIDY_EXE}
|
||||
-p ${CMAKE_BINARY_DIR}
|
||||
--warnings-as-errors='*'
|
||||
${ALL_SOURCE_FILES}
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
COMMENT "Checking clang-tidy..."
|
||||
)
|
||||
else()
|
||||
message(STATUS "clang-tidy no encontrado - targets 'tidy' y 'tidy-check' no disponibles")
|
||||
endif()
|
||||
|
||||
Reference in New Issue
Block a user