Chris Glover wrote:
On Fri, 30 Oct 2026 at 15:30, Peter Dimov <pdimov@gmail.com <mailto:pdimov@gmail.com> > wrote:
There are also downsides. If you add a header, but forget to add it to the CMakeLists.txt file (not an uncommon occurrence), everything will appear to work fine, but the header will not be installed.
This may go undetected for a long time if the test suite does not exercise every header (or does not test installation at all, also not an uncommon occurrence) and if the header is only needed rarely.
I agree. Bazel handles this by explicitly forbidding includes of unlisted files. We can't exactly do what Bazel does but we could get close by copying or symlinking the declared headers somewhere and only including from there. My instincts are telling me that's not a good idea, but it could be done.
At the moment my preferred solution would be to retain the globs, but only use CONFIGURE_DEPENDS for them if Boost is not a subproject. This feels like a reasonable compromise; people who FetchContent Boost don't need to rescan because the Boost sources are static. This can be accomplished by setting a variable BOOST_CONFIGURE_DEPENDS in the superproject to either empty or "CONFIGURE_DEPENDS" appropriately, then using file(GLOB_RECURSE headers ${BOOST_CONFIGURE_DEPENDS} include/*.hpp) instead of file(GLOB_RECURSE headers CONFIGURE_DEPENDS include/*.hpp)