Link What You Include - Maintain a Coherent CMake Target Model
summary
Tool enforces that CMake target link libraries match actual includes: if a target’s source or interface headers include B then CMake must list B, and vice versa. It ships as a CMake module that emits a JSON model, uses Clang libtooling on a compile_commands database, and maps headers to targets via verify interface header sets or include prefixes. A link-what-you-include run reports missing/extra links; a tidy mode flags forbidden deps and prevents growth of cyclic clusters. Open source on GitHub, single-config + export compile_commands required, intended for CI/PR checks.
AI-written summary · about
chapters (11)
- 0:00Introduction
- 9:25Modular architecture challenges
- 17:30CMake target model limits
- 27:42Modern CMake target model
- 35:45Link what you include rules
- 42:47Using the link tool
- 59:59Missing header manifests
- 1:08:25Enforcing coherent model
- 1:13:23Breaking cyclic dependencies
- 1:18:59Recommendations and goals
- 1:27:43Closing
related talks
01h 17mThe Importance of the C++ Build System Target Model
55mModern CMake for modular design
01h 01mClean CMake for C++ (library) developers
01h 02mDeep CMake for Library Authors
01h 01mGit, CMake, Conan - How to ship and reuse our C++ projects
01h 04mBetter CMake: A World Tour of Build Systems - Better C++ Builds
57mUsing Conan in a real-world complex project
01h 02mModern CMake Modules
