|
|
|
@ -11,6 +11,8 @@ if(CLANG_TIDY_EXE)
|
|
|
|
|
set(DCMAKE_EXPORT_COMPILE_COMMANDS ON)
|
|
|
|
|
set(CLANG_TIDY_CMD ${CLANG_TIDY_EXE})
|
|
|
|
|
message(STATUS "cmake source dir: ${CMAKE_CURRENT_SOURCE_DIR}")
|
|
|
|
|
# NOTE: copy default checks config file .clang-tidy for later use
|
|
|
|
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/.clang-tidy ${CMAKE_CURRENT_BINARY_DIR} @ONLY)
|
|
|
|
|
|
|
|
|
|
if(SPDLOG_ENABLE_TIDY)
|
|
|
|
|
# NOTE: the project config file .clang-tidy is not found if the
|
|
|
|
@ -29,9 +31,9 @@ if(CLANG_TIDY_EXE)
|
|
|
|
|
|
|
|
|
|
add_custom_command(TARGET check PRE_BUILD
|
|
|
|
|
# -p BUILD_PATH Path used to read a compile command database (compile_commands.json).
|
|
|
|
|
# NOTE: we use defaults checks from .clang-tidy and examples only!
|
|
|
|
|
COMMAND ${CLANG_TIDY_RUNNER} -p ${CMAKE_CURRENT_BINARY_DIR} ### ${CMAKE_CURRENT_SOURCE_DIR}/example
|
|
|
|
|
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" # location of compile_commands.json
|
|
|
|
|
# NOTE: we use default checks from .clang-tidy
|
|
|
|
|
COMMAND ${CLANG_TIDY_RUNNER} -p ${CMAKE_CURRENT_BINARY_DIR}
|
|
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} # location of compile_commands.json
|
|
|
|
|
COMMENT "Running check on targets at ${CMAKE_CURRENT_SOURCE_DIR} ..."
|
|
|
|
|
VERBATIM
|
|
|
|
|
)
|
|
|
|
|