mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-25 18:00:57 +00:00
For clang-cl, CMake sets the depfile flags to the gcc-style -MD, -MT and -MF, passed through as -clang: arguments. ccache does not parse those, so a cache hit writes only the object. Ninja has no depfile to read, so it records zero header dependencies for that object and does not rebuild it after a header edit. The stale object is still linked into the library and the DLL. sccache 0.15.0 reproduces the depfile on a hit and is unaffected. Use /showIncludes instead. CMake already does that for MSVC, and ccache reproduces it on a hit. A make-rules override sets the flags, because CMake includes the override after Platform/Windows-Clang.cmake. It is forwarded to each dependency because every one configures as its own CMake project, and it is only set when the file exists, because scripts/flatpak/make_deps_tar.sh packs deps/ alone. In a build with a warm cache, 678 of 790 objects had no recorded headers. Object code does not change. One GUI translation unit compiled both ways is byte-identical apart from the COFF timestamp.
11 lines
521 B
CMake
11 lines
521 B
CMake
# ccache does not parse the -clang: arguments CMake uses for clang-cl's gcc-style
|
|
# depfile, so a cache hit writes the object and no depfile, and Ninja then records
|
|
# no headers for that object. ccache reproduces /showIncludes output on a hit.
|
|
foreach (_lang C CXX)
|
|
if (CMAKE_${_lang}_COMPILER_ID STREQUAL "Clang" AND
|
|
CMAKE_${_lang}_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC")
|
|
set(CMAKE_DEPFILE_FLAGS_${_lang} "/showIncludes")
|
|
set(CMAKE_${_lang}_DEPFILE_FORMAT msvc)
|
|
endif ()
|
|
endforeach ()
|