From 5fbada942471ccf2dde01ccfc5577f008c15bd81 Mon Sep 17 00:00:00 2001 From: Andrew Nelless Date: Sun, 26 Nov 2017 16:36:47 +0000 Subject: [PATCH] Add support for clang-tidy checks --- CMakeLists.txt | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 673471b7..ecdbd11a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,6 +29,19 @@ if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug") add_definitions (-DNDEBUG) endif() +find_program (CLANG_TIDY_EXE + NAMES "clang-tidy" + DOC "Path to clang-tidy executable") + +if (SYNERGY_TIDY) + if (NOT CLANG_TIDY_EXE) + message (STATUS "clang-tidy not found.") + else () + message (STATUS "clang-tidy found: ${CLANG_TIDY_EXE}") + set (DO_CLANG_TIDY "${CLANG_TIDY_EXE}" "-checks=* -fix") + endif () +endif() + # # Synergy version # @@ -336,3 +349,9 @@ macro (configure_files srcDir destDir) endmacro (configure_files) add_subdirectory (src) + +if (SYNERGY_TIDY) + set_property (TARGET synergys synergyc synergy-core + arch base client common core io ipc mt net platform server shared + PROPERTY CXX_CLANG_TIDY "${DO_CLANG_TIDY}") +endif()