[llvm] [CMake] Make precompiled headers opt-in for ccache builds (PR #141927)
Kajetan Puchalski via llvm-commits
llvm-commits at lists.llvm.org
Thu May 29 04:07:36 PDT 2025
https://github.com/mrkajetanp created https://github.com/llvm/llvm-project/pull/141927
Using precompiled headers in ccache builds seems to be causing intermittent CI failures where CMake fails to rebuild the header when it's supposed to, such as:
https://www.mail-archive.com/llvm-bugs@lists.llvm.org/msg88645.html
Add a new LLVM_CCACHE_PCH option, set to OFF by default, in order to make using pch in ccache builds opt-in and avoid these failures in the CI.
>From 142956026c075271abcafa1af1ebd974ac31f420 Mon Sep 17 00:00:00 2001
From: Kajetan Puchalski <kajetan.puchalski at arm.com>
Date: Thu, 29 May 2025 10:59:51 +0000
Subject: [PATCH] [CMake] Make precompiled headers opt-in for ccache builds
Using precompiled headers in ccache builds seems to be causing
intermittent CI failures where CMake fails to rebuild the header
when it's supposed to, such as:
https://www.mail-archive.com/llvm-bugs@lists.llvm.org/msg88645.html
Add a new LLVM_CCACHE_PCH option, set to OFF by default, in order
to make using pch in ccache opt-in and avoid these failures in the CI.
Signed-off-by: Kajetan Puchalski <kajetan.puchalski at arm.com>
---
llvm/CMakeLists.txt | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt
index ed44b16bf9aeb..dbd43c3ece895 100644
--- a/llvm/CMakeLists.txt
+++ b/llvm/CMakeLists.txt
@@ -289,6 +289,12 @@ if(LLVM_CCACHE_BUILD)
set(LLVM_CCACHE_PARAMS "CCACHE_CPP2=yes CCACHE_HASHDIR=yes CCACHE_SLOPPINESS=pch_defines,time_macros"
CACHE STRING "Parameters to pass through to ccache")
+ # Using precompiled headers with ccache builds can result in intermittent CI failures
+ set(LLVM_CCACHE_PCH OFF CACHE BOOL "Use precompiled headers in ccache builds")
+ if (NOT LLVM_CCACHE_PCH)
+ set(CMAKE_DISABLE_PRECOMPILE_HEADERS "ON")
+ endif()
+
if(NOT CMAKE_HOST_WIN32)
set(CCACHE_PROGRAM "${LLVM_CCACHE_PARAMS} ${CCACHE_PROGRAM}")
if (LLVM_CCACHE_MAXSIZE)
More information about the llvm-commits
mailing list