82 lines
1.6 KiB
CMake
82 lines
1.6 KiB
CMake
|
project(clang-naming)
|
||
|
cmake_minimum_required(VERSION 3.0)
|
||
|
|
||
|
find_program(
|
||
|
CLANG_TIDY_EXE
|
||
|
NAMES
|
||
|
clang-tidy-14
|
||
|
clang-tidy-13
|
||
|
clang-tidy-12
|
||
|
clang-tidy-11
|
||
|
clang-tidy-10
|
||
|
clang-tidy-9
|
||
|
clang-tidy)
|
||
|
|
||
|
set(TESTS
|
||
|
AbstractClass
|
||
|
ClassConstant
|
||
|
Class
|
||
|
ClassMember
|
||
|
ClassMethod
|
||
|
Constant
|
||
|
ConstantMember
|
||
|
ConstantParameter
|
||
|
ConstantPointerParameter
|
||
|
ConstexprFunction
|
||
|
ConstexprMethod
|
||
|
ConstexprVariable
|
||
|
EnumConstant
|
||
|
Enum
|
||
|
Function
|
||
|
GlobalConstant
|
||
|
GlobalConstantPointer
|
||
|
GlobalFunction
|
||
|
GlobalPointer
|
||
|
GlobalVariable
|
||
|
IgnoreMainLikeFunctions
|
||
|
InlineNamespace
|
||
|
LocalConstant
|
||
|
LocalConstantPointer
|
||
|
LocalPointer
|
||
|
LocalVariable
|
||
|
MacroDefinition
|
||
|
Member
|
||
|
Method
|
||
|
Namespace
|
||
|
Parameter
|
||
|
ParameterPack
|
||
|
PointerParameter
|
||
|
PrivateMember
|
||
|
PrivateMethod
|
||
|
ProtectedMember
|
||
|
ProtectedMethod
|
||
|
PublicMember
|
||
|
PublicMethod
|
||
|
ScopedEnumConstant
|
||
|
StaticConstant
|
||
|
StaticVariable
|
||
|
Struct
|
||
|
TemplateParameter
|
||
|
TemplateTemplateParameter
|
||
|
TypeAlias
|
||
|
Typedef
|
||
|
TypeTemplateParameter
|
||
|
Union
|
||
|
ValueTemplateParameter
|
||
|
Variable
|
||
|
VirtualMethod
|
||
|
)
|
||
|
|
||
|
add_custom_target(test ALL)
|
||
|
|
||
|
foreach(T ${TESTS})
|
||
|
add_custom_target(
|
||
|
${T}
|
||
|
COMMAND ${CMAKE_COMMAND} -E echo "Fomatting ${T}.cpp"
|
||
|
COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_SOURCE_DIR}/sources/${T}.cpp" "${CMAKE_BINARY_DIR}/${T}.cpp"
|
||
|
COMMAND ${CLANG_TIDY_EXE} --fix -p ${CMAKE_BINARY_DIR} "${CMAKE_BINARY_DIR}/${T}.cpp"
|
||
|
COMMAND ${CMAKE_COMMAND} -E compare_files "${CMAKE_SOURCE_DIR}/expected/${T}.cpp" "${CMAKE_BINARY_DIR}/${T}.cpp"
|
||
|
)
|
||
|
add_dependencies(test ${T})
|
||
|
endforeach(T)
|