Open
Description
Zig Version
0.11.0
Steps to Reproduce and Observed Behavior
Download any project using CMake, e.g. zlib-ng:
$ git clone https://github.com/zlib-ng/zlib-ng
$ cd zlib-ng
Purge Zig cache and rebuild standard C library:
$ rm -rf ~/.cache/zig
$ zig cc /dev/null 2>/dev/null
Build zlib-ng with CMake:
$ mkdir build-with-depfiles
$ cd build-with-depfiles
$ CC="zig cc" CXX="zig c++" cmake ..
$ time make zlib >/dev/null && make clean && time make zlib >/dev/null
real 0m16.483s
user 0m14.633s
sys 0m2.011s
real 0m13.092s
user 0m11.359s
sys 0m1.741s
Expected Behavior
I expected the build time to improve significantly thanks to Zig's builtin caching system, but that wasn't the case.
Note that it works when the use of depfiles is disabled using -DCMAKE_DEPENDS_USE_COMPILER=OFF
.
Purge Zig cache and rebuild standard C library:
$ rm -rf ~/.cache/zig
$ zig cc /dev/null 2>/dev/null
Build zlib-ng with CMake without the use of depfiles:
$ mkdir build-without-depfiles
$ cd build-without-depfiles
$ CC="zig cc" CXX="zig c++" cmake -DCMAKE_DEPENDS_USE_COMPILER=OFF ..
$ time make zlib >/dev/null && make clean && time make zlib >/dev/null
real 0m17.608s
user 0m15.408s
sys 0m2.238s
real 0m1.242s
user 0m0.701s
sys 0m0.563s
The only difference between those invocations are the -MD
, -MF
, and -MT
flags.