Conditional includes generate unconditional dependencies
One of my colleagues recently pointed out to me that CMake generates unconditional dependencies for headers that are included behind an #ifdef even when said #ifdef is disabled. I've managed to confirm this with CMake 3.13.4 using the following reproducer:
Is there a way to get CMake dependency generation to obey the conditional? The workaround we've found so far are undesirable (marking the entire folder as a system path, which isn't appropriate in our use case) or ugly (using implicit depends include transforms).
We understand that the build would be "correct" in any case, as CMake's dependency generation is conservative, but in our case this is causing massive performance issues as the build machine is an embedded device attached to NFS and the dependency tree we're pulling in so large that we're thrashing the file system.
"Don't worry about what anybody else is going to do. The best way to predict the future is to invent it." - Alan Kay