Conditional includes generate unconditional dependencies

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Conditional includes generate unconditional dependencies

Elliott Slaughter
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:

./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

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake