diff --git a/scripts/.clang-tidy b/.clang-tidy similarity index 96% rename from scripts/.clang-tidy rename to .clang-tidy index af1db756..651fa8e9 100644 --- a/scripts/.clang-tidy +++ b/.clang-tidy @@ -13,7 +13,7 @@ readability-*,\ clang-analyzer-*' WarningsAsErrors: '' -HeaderFilterRegex: 'include/spdlog/[^f].*' +HeaderFilterRegex: '*spdlog/[^f].*' AnalyzeTemporaryDtors: false FormatStyle: none diff --git a/CMakeLists.txt b/CMakeLists.txt index 17d992d4..d617790d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -96,6 +96,17 @@ option(SPDLOG_NO_THREAD_ID "prevent spdlog from querying the thread id on each l option(SPDLOG_NO_TLS "prevent spdlog from using thread local storage" OFF) option(SPDLOG_NO_ATOMIC_LEVELS "prevent spdlog from using of std::atomic log levels (use only if your code never modifies log levels concurrently" OFF) +# clang-tidy +if(${CMAKE_VERSION} VERSION_GREATER "3.5") + option(SPDLOG_TIDY "run clang-tidy" OFF) +endif() + +if(SPDLOG_TIDY) + set(CMAKE_CXX_CLANG_TIDY "clang-tidy") + set(CMAKE_EXPORT_COMPILE_COMMANDS ON) + message(STATUS "Enabled clang-tidy") +endif() + find_package(Threads REQUIRED) message(STATUS "Build type: " ${CMAKE_BUILD_TYPE}) #--------------------------------------------------------------------------------------- @@ -289,6 +300,5 @@ if (SPDLOG_INSTALL) # Support creation of installable packages #--------------------------------------------------------------------------------------- include(cmake/spdlogCPack.cmake) - endif () diff --git a/scripts/clang_tidy.sh b/scripts/clang_tidy.sh deleted file mode 100755 index b62bfaf1..00000000 --- a/scripts/clang_tidy.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -cd "$(dirname "$0")" - -clang-tidy ../example/example.cpp -- -I ../include