mirror of
https://github.com/CLIUtils/CLI11.git
synced 2025-05-01 13:13:53 +00:00
Adding clang tidy details
This commit is contained in:
parent
101c926dac
commit
44f43bd621
7
.clang-tidy
Normal file
7
.clang-tidy
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#Checks: '*,-clang-analyzer-alpha.*'
|
||||||
|
Checks: '-*,google-readability-casting,llvm-namespace-comment,performance-unnecessary-value-param,llvm-include-order,misc-throw-by-value-catch-by-reference,readability-container-size-empty,google-runtime-references,modernize*'
|
||||||
|
HeaderFilterRegex: '.*hpp'
|
||||||
|
CheckOptions:
|
||||||
|
- key: readability-braces-around-statements.ShortStatementLines
|
||||||
|
value: '1'
|
||||||
|
|
@ -22,6 +22,24 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
if(CMAKE_VERSION VERSION_GREATER 3.6)
|
||||||
|
# Add clang-tidy if available
|
||||||
|
option(CLANG_TIDY_FIX "Perform fixes for Clang-Tidy (resets to OFF)" OFF)
|
||||||
|
find_program(
|
||||||
|
CLANG_TIDY_EXE
|
||||||
|
NAMES "clang-tidy"
|
||||||
|
DOC "Path to clang-tidy executable"
|
||||||
|
)
|
||||||
|
|
||||||
|
if(CLANG_TIDY_EXE)
|
||||||
|
if(CLANG_TIDY_FIX)
|
||||||
|
set(DO_CLANG_TIDY "${CLANG_TIDY_EXE}" "-fix")
|
||||||
|
else()
|
||||||
|
set(DO_CLANG_TIDY "${CLANG_TIDY_EXE}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
if(CMAKE_BUILD_TYPE STREQUAL Coverage)
|
if(CMAKE_BUILD_TYPE STREQUAL Coverage)
|
||||||
include(CodeCoverage)
|
include(CodeCoverage)
|
||||||
@ -64,3 +82,4 @@ if(CLI_EXAMPLES)
|
|||||||
add_subdirectory(examples)
|
add_subdirectory(examples)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
set(CLANG_TIDY_FIX OFF CACHE BOOL "Perform fixes for Clang-Tidy (resets to OFF)" FORCE)
|
||||||
|
@ -1,8 +1,15 @@
|
|||||||
add_executable(try try.cpp ${CLI_headers})
|
function(add_cli_exe T)
|
||||||
target_link_libraries(try PUBLIC CLI11)
|
add_executable(${T} ${ARGN} ${CLI_headers})
|
||||||
|
target_link_libraries(${T} PUBLIC CLI11)
|
||||||
|
|
||||||
add_executable(try1 try1.cpp ${CLI_headers})
|
if(CLANG_TIDY_EXE)
|
||||||
target_link_libraries(try1 PUBLIC CLI11)
|
set_target_properties(
|
||||||
|
${T} PROPERTIES
|
||||||
|
CXX_CLANG_TIDY "${DO_CLANG_TIDY}"
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
endfunction()
|
||||||
|
|
||||||
add_executable(try2 try2.cpp ${CLI_headers})
|
add_cli_exe(try try.cpp)
|
||||||
target_link_libraries(try2 PUBLIC CLI11)
|
add_cli_exe(try1 try1.cpp)
|
||||||
|
add_cli_exe(try2 try2.cpp)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user