From 737e0980fef1c2d573afedc8b00f7caf30617652 Mon Sep 17 00:00:00 2001 From: Pascal Date: Sat, 12 Sep 2026 22:47:14 +0200 Subject: [PATCH] cmake: leave the timestamp out of precompiled headers on clang (#28816) Clang stores the modification time of the precompiled header sources inside the header and refuses the header when they differ. A cached header restored from another checkout carries the timestamps of that checkout, so the build fails. The option covers the compilers ccache treats as MSVC while they are clang underneath, clang-cl and the Intel LLVM drivers. --- CMakeLists.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 86b09dfd46..4052fa3d61 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -197,6 +197,16 @@ llama_option_depr(WARNING LLAMA_CURL) include("cmake/license.cmake") license_add_file("llama.cpp" "LICENSE") +# +# compile options +# + +# clang stores the modification time of the precompiled header sources inside the +# header and rejects it when they differ, so the timestamp is left out of it +add_compile_options( + "$<$:SHELL:-Xclang -fno-pch-timestamp>" + "$<$:SHELL:-Xclang -fno-pch-timestamp>") + # # 3rd-party #