[Bf-blender-cvs] [743b9c5e1d9] master: CMake: fix build issue with gcc+clang-tidy

Ray Molenkamp noreply at git.blender.org
Thu Jan 13 17:47:20 CET 2022


Commit: 743b9c5e1d9e9d23b8f51fd6778db8292de204ae
Author: Ray Molenkamp
Date:   Thu Jan 13 09:47:14 2022 -0700
Branches: master
https://developer.blender.org/rB743b9c5e1d9e9d23b8f51fd6778db8292de204ae

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

===================================================================

M	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)



More information about the Bf-blender-cvs mailing list