cmake-guidelisted
Install: claude install-skill xonovex/platform
# CMake Coding Guidelines
## Requirements
- CMake ≥ 3.20; modern target-based usage.
## Essentials
- **Target-based builds** - Use targets, no global include/link dirs, see [references/target-types.md](references/target-types.md), [references/compile-options.md](references/compile-options.md)
- **Visibility specifiers** - Use PUBLIC/PRIVATE/INTERFACE correctly, see [references/visibility-specifiers.md](references/visibility-specifiers.md)
- **Dependencies** - Declare explicitly with find_package, see [references/find-package.md](references/find-package.md)
- **Testing** - Enable testing with CTest, see [references/testing.md](references/testing.md)
- **Project structure** - Organize multi-directory projects, see [references/project-structure.md](references/project-structure.md)
## Gotchas
- `target_link_libraries` scope matters: PRIVATE = consumers don't see it, INTERFACE = no compile, PUBLIC = both. Wrong scope leaks transitive deps
- `find_package` may use PATHS or HINTS but ignores both if a config file is on a system path; use `<Pkg>_ROOT` env var to force-locate
- Generator expressions (`$<CONFIG:Debug>`) only evaluate at build time: debugging by `message()` won't show their final values
- `CMAKE_INSTALL_PREFIX` is captured at configure time; changing it after first config requires a clean reconfigure
## Progressive disclosure
- Read [references/target-types.md](references/target-types.md) - Load when choosing between library types or executables
- Read [referenc