- integrations
- CMake
- Concepts
- How find_ocx works
How find_ocx works
This page explains what find_ocx does at configure and build time, and why it keeps all resolution inside the ocx binary.
Why it never re-implements ocx
Section titled “Why it never re-implements ocx”find_ocx deliberately never re-implements OCX internals in CMake.
All resolution goes through the ocx binary.
The durable contracts are the ocx.lock digests and the OCI manifests, so CMake code never has to track how ocx resolves a tag.
What happens, in order
Section titled “What happens, in order”ocx_bootstrap()runs implicitly on first use. It downloads the pinned ocx release listed in the dist.json snapshot embedded inocx.cmake, checks its sha256, and stores it in~/.cache/find_ocx. All build trees on the machine share that cache.ocx_project()andocx_package()shell out to that binary. They runocx lock --checkas a staleness gate every time. Eager mode addsocx pullorocx package install, and foreign platforms useocx --format json env.- The exported
OCX_<NAME>_RUNvariables are plain CMake command lists. They re-enterocx runorocx package exec, so no wrapper scripts are needed and generator expressions compose. - Content materializes lazily on first execution into the shared, content-addressed
OCX_HOMEstore. - Reconfigures are memoized by input fingerprints.
With unchanged inputs no
ocxprocess starts, and-DOCX_REFRESH=ONbypasses the memo once.
Where to go next
Section titled “Where to go next”- Two entry points explains which binary runs.
- Lazy versus eager explains when the network is touched.
- Reproducible first explains why a floating tag is an error.