summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortastytea2020-01-26 05:17:04 +0100
committertastytea2020-01-26 05:20:05 +0100
commit3876cf3f01f7325d58c7cdf65e5d168fec9cd1c7 (patch)
treebb5acc9840c3404940c8508bedc80d0072f353d9
parent151103a9a150a520edee280eb0962ca4058816c0 (diff)
downloadmastodonpp-3876cf3f01f7325d58c7cdf65e5d168fec9cd1c7.tar
mastodonpp-3876cf3f01f7325d58c7cdf65e5d168fec9cd1c7.tar.gz
mastodonpp-3876cf3f01f7325d58c7cdf65e5d168fec9cd1c7.zip
Add WITH_CLANG-TIDY to CMake recipe.
-rw-r--r--CMakeLists.txt7
-rw-r--r--README.adoc3
2 files changed, 10 insertions, 0 deletions
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.