From 743b9c5e1d9e9d23b8f51fd6778db8292de204ae Mon Sep 17 00:00:00 2001 From: Ray Molenkamp Date: Thu, 13 Jan 2022 09:47:14 -0700 Subject: CMake: fix build issue with gcc+clang-tidy Precompiled headers are in a compiler specific format, when using clang-tidy it tries to read the GCC PCH file and fails at that. Disable PCH's for now when WITH_CLANG_TIDY is enabled since a clean work-around doesn't seem readily available. relevant LLVM/CMake bugs: https://bugs.llvm.org/show_bug.cgi?id=41579 https://gitlab.kitware.com/cmake/cmake/-/issues/22081 Differential Revision: https://developer.blender.org/D13814 Reviewed by: sergey, Blendify --- source/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'source/CMakeLists.txt') diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 0ce2341fc2e..6c2cbb5df33 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -25,6 +25,10 @@ endif() if(WITH_CLANG_TIDY AND NOT MSVC) if(NOT CMAKE_C_COMPILER_ID MATCHES "Clang") message(WARNING "Currently Clang-Tidy might fail with GCC toolchain, switch to Clang toolchain if that happens") + if(COMMAND target_precompile_headers) + message(STATUS "Clang-Tidy and GCC precompiled headers are incompatible, disabling precompiled headers") + set(CMAKE_DISABLE_PRECOMPILE_HEADERS On) + endif() endif() find_package(ClangTidy REQUIRED) -- cgit v1.2.3