[CMake] Conditional includes generate unconditional dependencies
Elliott Slaughter
elliottslaughter at gmail.com
Tue Mar 5 17:14:46 EST 2019
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:
git clone
https://github.com/elliottslaughter/test-cmake-conditional-include.git
./test.sh
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.
Thanks.
--
Elliott Slaughter
"Don't worry about what anybody else is going to do. The best way to
predict the future is to invent it." - Alan Kay
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20190305/6344ea53/attachment.html>
More information about the CMake
mailing list