From a7a53ef09257529fea095dc9b8ff9ebf22c7acbe Mon Sep 17 00:00:00 2001 From: Ben Davis Date: Tue, 12 Oct 2021 15:06:40 +0100 Subject: [PATCH] Integrate clang-tidy-8 with cmake build We will now run clang-tidy if available as part of the standard build with the bugprone-* and modernize-* checks Change-Id: I4c9d3cf8712f802b912d32a443bca1584169a8b3 Signed-off-by: Ben Davis --- CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1dc13b4..608a92c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,6 +26,13 @@ project(VkLayer_window_system_integration) find_package(PkgConfig REQUIRED) pkg_check_modules(VULKAN_PKG_CONFIG vulkan) +find_program(CLANG_TIDY clang-tidy-8) + +if (NOT CLANG_TIDY STREQUAL "CLANG_TIDY-NOTFOUND") + message(STATUS "Using clang-tidy: ${CLANG_TIDY}") + set(CMAKE_CXX_CLANG_TIDY ${CLANG_TIDY} -checks=bugprone-*,modernize-*) +endif() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pthread -fPIC") if (DEFINED DEBUG) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0") -- 2.34.1