From 9e32074fa7b74643ed69f1eb31847be88e508eb7 Mon Sep 17 00:00:00 2001 From: Jonathan Hollocombe Date: Mon, 22 Jan 2024 15:02:04 +0000 Subject: [PATCH] Adding clang-tidy cmake files. --- .clang-tidy | 13 +++++++++++++ cmake/StaticAnalyzers.cmake | 20 ++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 .clang-tidy create mode 100644 cmake/StaticAnalyzers.cmake diff --git a/.clang-tidy b/.clang-tidy new file mode 100644 index 00000000..664df431 --- /dev/null +++ b/.clang-tidy @@ -0,0 +1,13 @@ +--- +Checks: '-*,readability-identifier-naming' +CheckOptions: + - { key: readability-identifier-naming.NamespaceCase, value: lower_case } + - { key: readability-identifier-naming.ClassCase, value: CamelCase } + - { key: readability-identifier-naming.PrivateMemberPrefix, value: _ } + - { key: readability-identifier-naming.StructCase, value: CamelCase } + - { key: readability-identifier-naming.FunctionCase, value: lower_case } + - { key: readability-identifier-naming.VariableCase, value: lower_case } + - { key: readability-identifier-naming.GlobalConstantCase, value: UPPER_CASE } +WarningsAsErrors: '-*' +HeaderFilterRegex: '*.h' +FormatStyle: llvm \ No newline at end of file diff --git a/cmake/StaticAnalyzers.cmake b/cmake/StaticAnalyzers.cmake new file mode 100644 index 00000000..143f3533 --- /dev/null +++ b/cmake/StaticAnalyzers.cmake @@ -0,0 +1,20 @@ +if( ENABLE_CLANG_TIDY ) + find_program( CLANGTIDY clang-tidy ) + if( CLANGTIDY ) + set( CMAKE_CXX_CLANG_TIDY ${CLANGTIDY} -extra-arg=-Wno-unknown-warning-option ) + message( "Clang-Tidy finished setting up." ) + else() + message( SEND_ERROR "Clang-Tidy requested but executable not found." ) + endif() +endif() + +if( ENABLE_CPPCHECK ) + find_program( CPPCHECK cppcheck ) + if( CPPCHECK ) + set( CMAKE_CXX_CPPCHECK ${CPPCHECK} --suppress=missingInclude --enable=all + --inline-suppr --inconclusive -i ${CMAKE_SOURCE_DIR}/imgui/lib ) + message( "Cppcheck finished setting up." ) + else() + message( SEND_ERROR "Cppcheck requested but executable not found." ) + endif() +endif() \ No newline at end of file