mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-16 13:32:44 +00:00
Allow ccache with PCH
Clang records the modification time of every input in the precompiled header, so a fresh checkout produces a different header and every file that includes it misses the compiler cache. -fno-pch-timestamp makes the header reproducible, and pch_defines lets ccache cache the header itself. The precompiled header no longer has to be turned off when the cache is on.
This commit is contained in:
@@ -256,6 +256,13 @@ function(add_precompiled_header _target _input)
|
||||
message(STATUS "Adding precompiled header ${_input} to target ${_target}.")
|
||||
target_precompile_headers(${_target} PRIVATE ${_input})
|
||||
|
||||
# Clang records the modification time of every input in the precompiled
|
||||
# header, which makes it differ between two checkouts of the same source
|
||||
# and defeats a compiler cache. The build system already rebuilds the
|
||||
# header when an input changes.
|
||||
target_compile_options(${_target} PRIVATE
|
||||
"$<$<CXX_COMPILER_ID:Clang,AppleClang>:SHELL:-Xclang -fno-pch-timestamp>")
|
||||
|
||||
get_target_property(_sources ${_target} SOURCES)
|
||||
list(FILTER _sources INCLUDE REGEX ".*\\.mm?")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user