From cf4365e555a759d5b3225bce77858374cb07faad Mon Sep 17 00:00:00 2001 From: Ray Molenkamp Date: Thu, 1 Feb 2024 09:09:20 -0700 Subject: [PATCH] CMake: Disable unity builds on cmake 2.28.2 CMake 2.28.2 has a regression that breaks the combination of precompiled headers and unity builds [1]. Disable unity builds for this specific cmake version to sidestep the issue. [1] https://gitlab.kitware.com/cmake/cmake/-/issues/25650 --- CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c12dc749ce3..7460f0282ce 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -245,7 +245,9 @@ mark_as_advanced(CPACK_OVERRIDE_PACKAGENAME) mark_as_advanced(BUILDINFO_OVERRIDE_DATE) mark_as_advanced(BUILDINFO_OVERRIDE_TIME) -if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.16") +# CMAKE 3.28.2 has issues with the combination of PCH and unity builds, disable for now. +# upstream ticket https://gitlab.kitware.com/cmake/cmake/-/issues/25650 +if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.16" AND NOT ${CMAKE_VERSION} VERSION_EQUAL "3.28.2") option(WITH_UNITY_BUILD "\ Enable unity build for modules that support it to improve compile times.\n\ WARNING: this option allows files to be built without all necessary headers!\n