# CMake helper API manual This manual documents the project helper API implemented under `cmake/`. The examples are intentionally close to the positive helper fixtures and current root usage, but paths and target names are illustrative unless a section explicitly says otherwise. ## Global conventions - Call native `project( LANGUAGES C CXX)` before `cc_project()`; the helper rejects CMake's implicit `project(Project)` default. - The primary project standard is C++14. Fuzz lane targets require the fuzz preset or equivalent Clang + C++17 configuration. - `INCS`, `DEPS`, and `DEFINES` use explicit visibility groups. Every item must follow `PUBLIC`, `PRIVATE`, or `INTERFACE`; unqualified items are rejected. - Executable-like targets (`cc_executable`, `cc_test`, `cc_benchmark`, and `cc_fuzz`) do not support `INTERFACE` visibility because they are not consumed as link interfaces. Use `PUBLIC` or `PRIVATE` only. - `cc_library(TYPE INTERFACE)` supports only `INTERFACE` visibility for `INCS`, `DEPS`, and `DEFINES`. - Helpers automatically link the framework Core runtime defaults: `spdlog::spdlog`, `fmt::fmt`, `nlohmann_json::nlohmann_json`, `toml11::toml11`, `CLI11::CLI11`, `asio::asio`, `concurrentqueue::concurrentqueue`, `ghcFilesystem::ghc_filesystem`, `nonstd::expected-lite`, and `httplib::httplib`. Static/shared libraries receive these defaults as `PUBLIC`, interface libraries as `INTERFACE`, and executable-like targets as `PRIVATE`. - Helpers do not acquire lane-specific external dependencies directly. The template infrastructure loads `GTest::gtest`, `benchmark::benchmark`, and `fuzztest::fuzztest` from the committed archive model when the corresponding helper lane is enabled. - There are aggregate targets `run_tests` and `run_benchmarks`, but no per-target `run_test_`, `run_benchmark_`, or `run_fuzz_` wrappers. ## `cc_project()` Signature: ```cmake cc_project() ``` Use in the root `CMakeLists.txt` after native `project()` and after any cache variables that should influence helper options. ```cmake cmake_minimum_required(VERSION 3.19) project(my_package LANGUAGES C CXX) include(cmake/cc_project.cmake) cc_project() ``` Behavior: - Sets C++ defaults: C++14 by default, required standard, extensions off. - Enables `CMAKE_EXPORT_COMPILE_COMMANDS` unless the caller already set it. - Enables position-independent code. - Defines helper options: - `CC_ENABLE_INSTALL`: ON by default for the top-level project, OFF for subprojects. - `CC_ENABLE_TESTING`: ON by default. - `CC_ENABLE_BENCHMARKS`: ON by default. - `CC_ENABLE_FUZZTEST`: ON by default as a capability-gated request; actual fuzz targets are created only for the isolated Clang + C++17 fuzz lane. - `CC_ENABLE_ASAN`: OFF by default; adds AddressSanitizer compile/link flags. - `CC_WARNINGS_AS_ERRORS`: OFF by default. - Uses public lane options only: `CC_ENABLE_TESTING`, `CC_ENABLE_BENCHMARKS`, `CC_ENABLE_FUZZTEST`, and `CC_ENABLE_ASAN`. Users do not need lane `if()` wrappers around `cc_test()`, `cc_benchmark()`, or `cc_fuzz()`. - Creates top-level aggregate targets when enabled: - `run_tests`: runs `ctest --output-on-failure`. - `run_benchmarks`: aggregate target populated by `cc_benchmark()`. - Defers `cc_finalize_install()` at generate time when the install module is included. ## `cc_library()` Signature: ```cmake cc_library( TYPE STATIC|SHARED|INTERFACE [SRCS ...] [HDRS ...] [INCS [PUBLIC|PRIVATE|INTERFACE ...]...] [DEPS [PUBLIC|PRIVATE|INTERFACE ...]...] [DEFINES [PUBLIC|PRIVATE|INTERFACE ...]...] [OPTIONS