This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
A collection of reusable CMake modules that fetch and configure third-party C/C++ libraries via CMake's FetchContent. Each library lives in its own directory containing a GetXxx.cmake module (the reusable artifact) and a demo CMakeLists.txt + main.cpp showing usage.
Test a single library (e.g., fmt):
cmake -B build -S fmt && cmake --build buildDo NOT build from the root with all subdirectories uncommented — there are known conflicts between some libraries.
./format.shThis runs clang-format (Google style, unlimited column width) on C++/proto files and cmake-format on CMake files, both excluding build/.
Each library directory follows the same pattern:
GetXxx.cmake— standalone FetchContent module that declares, downloads, configures, and exposes import targets. This is the file users copy into their own projects.CMakeLists.txt— minimal demo project that includes the Get module and links a test executable.main.cpp— trivial usage example.
Some libraries with transitive dependencies (e.g., opentelemetry_cpp, grpc, paho_mqtt_cpp) include multiple Get modules in their directory for the full dependency chain.
- Create a directory named after the library.
- Write a
GetXxx.cmakethat usesFetchContent_Declare/FetchContent_MakeAvailable, sets necessary cache variables, and documents the import targets in a trailing comment. - Add a demo
CMakeLists.txtthat includes the module viaCMAKE_MODULE_PATHand links the target. - Add a
main.cppthat exercises the library minimally. - Add an entry to the root
CMakeLists.txt(commented out) andREADME.md. - Run
./format.shbefore committing.
- Minimum CMake version: 3.26
- Get modules use
FetchContent_GetProperties+if(NOT xxx_POPULATED)guard to avoid double-fetch. - Configuration options are set as
CACHEvariables beforeFetchContent_MakeAvailable. - Import targets are listed in a comment at the end of each Get module.