From 3876cf3f01f7325d58c7cdf65e5d168fec9cd1c7 Mon Sep 17 00:00:00 2001 From: tastytea Date: Sun, 26 Jan 2020 05:17:04 +0100 Subject: [PATCH] Add WITH_CLANG-TIDY to CMake recipe. --- CMakeLists.txt | 7 +++++++ README.adoc | 3 +++ 2 files changed, 10 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 647e636..4db25d3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,6 +22,7 @@ option(WITH_TESTS "Compile tests." NO) option(WITH_EXAMPLES "Compile examples." NO) option(WITH_DEB "Prepare for the building of .deb packages." NO) option(WITH_RPM "Prepare for the building of .rpm packages." NO) +option(WITH_CLANG-TIDY "Check sourcecode with clang-tidy while compiling." NO) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) @@ -29,6 +30,12 @@ set(CMAKE_CXX_EXTENSIONS OFF) include(debug_flags) +if(WITH_CLANG-TIDY) + set(CMAKE_CXX_CLANG_TIDY + "clang-tidy" + "-p=build" + "-header-filter=${PROJECT_SOURCE_DIR}" + "-quiet") endif() add_subdirectory(src) diff --git a/README.adoc b/README.adoc index cd81efe..506d6c8 100644 --- a/README.adoc +++ b/README.adoc @@ -16,6 +16,7 @@ :uri-rpm-build: http://www.rpm.org :uri-libcurl: https://curl.haxx.se/libcurl/ :uri-nodeinfo: https://nodeinfo.diaspora.software/ +:uri-clang-tidy: https://clang.llvm.org/extra/clang-tidy/ *{project}* is a C++ wrapper for the link:{uri-wp-mastodon}[Mastodon] and link:{uri-pleroma}[Pleroma] APIs. It replaces @@ -150,6 +151,8 @@ cmake --build . -- -j$(nproc --ignore=1) * `-DCMAKE_BUILD_TYPE=Debug` for a debug build. * `-DWITH_TESTS=YES` if you want to compile the tests. * `-DWITH_EXAMPLES=YES` if you want to compile the examples. +* `-DWITH_CLANG-TIDY=YES` to check the sourcecode with + link:{uri-clang-tidy}[clang-tidy] while compiling. * One of: ** `-DWITH_DEB=YES` if you want to be able to generate a deb-package. ** `-DWITH_RPM=YES` if you want to be able to generate an rpm-package.