From 73689925da8d33c9ec73d5ead39db5535fe96022 Mon Sep 17 00:00:00 2001 From: derselbst Date: Sat, 1 Dec 2018 13:56:51 +0100 Subject: [PATCH] disable clang-tidy for normal builds It may cause errors when cross compiling. Keep it for profiling builds though. Fixes #475. --- CMakeLists.txt | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 298199dc..a0445467 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -342,6 +342,18 @@ if ( enable-profiling ) endif ( ) set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OPT_FLAGS}" ) + + if ( CMAKE_VERSION VERSION_GREATER "3.6.0" ) + find_program( CLANG_TIDY + NAMES "clang-tidy" + DOC "Path to clang-tidy executable" ) + + if ( CLANG_TIDY ) + message ( STATUS "Found clang-tidy" ) + set ( CMAKE_C_CLANG_TIDY "clang-tidy" ) + endif ( CLANG_TIDY ) + endif ( CMAKE_VERSION VERSION_GREATER "3.6.0" ) + endif ( enable-profiling ) unset ( ENABLE_TRAPONFPE CACHE ) @@ -375,22 +387,6 @@ if ( CMAKE_BUILD_TYPE MATCHES "Debug" ) set ( DEBUG 1 ) endif ( CMAKE_BUILD_TYPE MATCHES "Debug" ) -if ( CMAKE_VERSION VERSION_GREATER "3.6.0" ) -find_program( CLANG_TIDY - NAMES "clang-tidy" - DOC "Path to clang-tidy executable" ) - - if ( CLANG_TIDY ) - message ( STATUS "Found clang-tidy" ) - # whenever clang-tidy is available, use it to automatically add braces after ever "make" - if ( WITH_PROFILING ) - set ( CMAKE_C_CLANG_TIDY "clang-tidy" ) - else ( WITH_PROFILING ) - set ( CMAKE_C_CLANG_TIDY "clang-tidy;-checks=-*,readability-braces-*;-format-style=file" ) - endif ( WITH_PROFILING ) - endif ( CLANG_TIDY ) -endif ( CMAKE_VERSION VERSION_GREATER "3.6.0" ) - # Additional targets to perform clang-format/clang-tidy # Get all project files file(GLOB_RECURSE