ores.cmake.component
Table of Contents
This page is the node for the ores.cmake.component facet of the codegen
template library, part of the ores.cmake technical space. Each archetype
below is documented, and holds its mustache source, in its own
linked page — this page is the facet-level summary and the routing
table to them.
1. Summary
These templates generate the CMake build files for a component: the
part root dispatcher, the composite root that adds a component's
parts, four src variants for the plain / api / core / service
component flavours, the Catch2 test wiring, and the PlantUML diagram
target.
2. The ores.cmake.component facet
Projects a component onto its CMake build files: which targets
exist, what they link, and how tests and diagrams are wired into the
global run_all_tests / make_all_diagrams aggregation targets. The
facet's shape follows the api/core/service component split described
in component architecture: every part gets the same root, tests,
and modeling files, while src/CMakeLists.txt varies by component
flavour — that is why there are four *_src variants but only one of
each of the others.
A composite is the exception, and #+component_kind: is what
separates the two. It owns no code, so it generates none of the
code-bearing archetypes; the one file it does own is the
CMakeLists.txt that adds its parts.
3. Mustache incantations
{{#component}}…{{/component}}- section. Renders its body
with the component object pushed onto the context stack, so bare
names inside resolve against the component first; it also guards —
a missing
componentrenders empty rather than fails. {{full_name}}- escaped interpolation, resolved against the enclosing component. HTML-escaping is a no-op for the identifiers that appear here.
{{{cmake_license}}}- triple-stache (unescaped interpolation) — see the group doc's shared conventions.
{{! … }}- comment, removed with its line — what makes the GENERATED FILE header output-neutral.
4. Archetypes
| Archetype | Description |
|---|---|
| ores.cmake.component.api_src | src/CMakeLists.txt for an .api component (component-api profile): pure-types library linking only the eventing/platform public surface. Output projects/{component_full}/src/CMakeLists.txt. |
| ores.cmake.component.composite_root | The composite root CMakeLists.txt: adds the component's parts and nothing else. Output projects/{component_dir}/CMakeLists.txt. |
| ores.cmake.component.core_src | src/CMakeLists.txt for a .core component (component-core profile): links its sibling api library ({{api_full_name}}.lib) publicly plus the NATS/service stack privately. Output projects/{component_full}/src/CMakeLists.txt. |
| ores.cmake.component.files_src | src/component_files.cmake for every component profile: an explicit, checked-in set(files ...) list of every *.cpp under src/ (plus a set(HEADERS ...) list of every *.hpp under include/, for components that have one), included by CMakeLists.txt in place of file(GLOB_RECURSE ...). Regenerated by projects/ores.codegen/scripts/regenerate_cmake_component_files.py, not the general compass codegen regenerate path (see that script's docstring for why). Output projects/{component_dir}/src/component_files.cmake. |
| ores.cmake.component.files_tests | tests/component_files.cmake for every component profile: an explicit, checked-in set(files ...) list of every *.cpp under tests/, included by CMakeLists.txt in place of file(GLOB_RECURSE ...). Regenerated by projects/ores.codegen/scripts/regenerate_cmake_component_files.py, not the general compass codegen regenerate path (see that script's docstring for why). Output projects/{component_dir}/tests/component_files.cmake. |
| ores.cmake.component.modeling | modeling/CMakeLists.txt for every component profile: the generate_<name>_diagram PlantUML target, wired into make_all_diagrams. Output projects/{component_full}/modeling/CMakeLists.txt. |
| ores.cmake.component.root | Tiny dispatcher: the component root CMakeLists.txt just descends into src/, tests/ and modeling/. Used by every component profile (component, component-api, component-core, component-service); output projects/{component_full}/CMakeLists.txt. |
| ores.cmake.component.src | src/CMakeLists.txt for a plain library component (component profile): one shared library from all *.cpp under src/, with the database/utility/sqlgen dependency set. Output projects/{component_full}/src/CMakeLists.txt. |
| ores.cmake.component.tests | tests/CMakeLists.txt for every component profile: a Catch2 test executable from all *.cpp under tests/, the test_<name> custom target wired into run_all_tests, and the CTest registration with XML output. (The repeated boilerplate across the 65 per-component test files is the subject of the centralise-test-target capture.) Output projects/{component_full}/tests/CMakeLists.txt. |
5. See also
- ores.cmake — the parent technical space's generated facet/archetype catalogue and shared Mustache conventions.
- Other Technical Spaces § "CMake Technical Space" — the domain-concept overview of this technical space.
- Codegen template library — the groups overview.