aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt29
1 files changed, 29 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index bdda024..0562c1c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -7,6 +7,15 @@ project("ttwhy"
include("CTest")
+### System Tools
+
+find_program(CLANG_TIDY_PATH NAMES
+ "clang-tidy"
+ "clang-tidy-22"
+ "clang-tidy-23"
+ "clang-tidy-24"
+)
+
### System Dependencies
find_package("Threads")
@@ -95,6 +104,16 @@ target_compile_options("ttwhy-core" PUBLIC
"$<$<CXX_COMPILER_ID:Clang,GNU>:-pedantic-errors>"
)
+if(CLANG_TIDY_PATH)
+ set_target_properties("ttwhy-core" PROPERTIES
+ CXX_CLANG_TIDY "${CLANG_TIDY_PATH}"
+ )
+else()
+ message(AUTHOR_WARNING
+ "clang-tidy not found; skipping linting for 'ttwhy::core'"
+ )
+endif()
+
### Applications
add_executable("ttwhy-echo")
@@ -108,6 +127,16 @@ target_link_libraries("ttwhy-echo" PRIVATE
"ttwhy::lib"
)
+if(CLANG_TIDY_PATH)
+ set_target_properties("ttwhy-echo" PROPERTIES
+ CXX_CLANG_TIDY "${CLANG_TIDY_PATH}"
+ )
+else()
+ message(AUTHOR_WARNING
+ "clang-tidy not found; skipping linting for 'ttwhy::echo'"
+ )
+endif()
+
### Tests
if(BUILD_TESTING)