Repository navigation
Description
Goal
Keep selective installation support, but move its naming, defaults, and initialization-order requirements into cpp-library rather than requiring clients to reproduce CMake infrastructure.
Installation rules do not install anything during a normal build. The namespace/package options choose which packages participate when the user explicitly invokes installation. This issue does not propose removing that capability or automatically installing anything.
Client boilerplate today
cel-std currently needs to initialize its shared namespace option before fetching cel-parser:
project(std LANGUAGES CXX)
include(CTest)
option(CEL_INSTALL "Enable installation for CEL libraries" ${PROJECT_IS_TOP_LEVEL})
CPMAddPackage(
NAME cel-parser
GITHUB_REPOSITORY stlab/cel-parser
GIT_TAG <reviewed-commit>
)
# cpp_library_setup(NAMESPACE cel ...) follows.The explicit client option duplicates the policy already implemented inside _cpp_library_setup_install():
- Derive the option from the uppercase namespace, unless INSTALL_OPTION supplies a custom name.
- Default to PROJECT_IS_TOP_LEVEL.
- Preserve an existing caller/cache choice.
It exists early because normal library setup currently happens after dependencies. Without that declaration, parser/runtime setup can create the shared CEL_INSTALL cache entry first, defaulting it to OFF as a dependency. The top-level library later preserves that OFF value. Thus a clients default depends on which package initializes the shared cache entry first.
Requested improvement
Provide a toolkit-owned way to establish the installation policy after project() but before dependencies are configured. Reuse one implementation of option naming/defaulting in early initialization and regular setup.
An explicit initializer accepting NAMESPACE and optional INSTALL_OPTION is one possible design; it would replace manual client option(...) declarations without making clients specify uppercase option names or repeat PROJECT_IS_TOP_LEVEL policy. Alternatively, if the existing cpp_library_setup() can reliably precede dependency loading, document and test that supported ordering to achieve the same result without another API.
Do not infer the namespace from the project name: they differ for projects such as project(std) with NAMESPACE cel. Do not initialize a parent build policy globally or force existing cache preferences. Keep the literal client project() call.
Preserve existing capabilities
- Same-namespace packages can share a deliberately initialized installation choice.
- INSTALL_OPTION continues to allow independent installation of packages sharing a namespace.
- Explicit caller ON/OFF values remain authoritative.
- Standalone/subproject defaults are established in the intended project scope.
- Library installation rules remain separate from actually executing
cmake --install. - Preserve the nested target-scoped deferred install metadata fixes from PR Support independent nested installs and Windows DLL consumers #27.
The README should show the supported dependency ordering and explain that these options select participation in an explicit installation, not whether a normal build automatically installs libraries.
Regression coverage
Test a top-level library depending on two same-namespace nested libraries, independent custom installation options, caller overrides, source-consumer builds, and an explicit staged installation followed by an installed consumer. Verify the default build itself does not execute installation.
References
- Existing namespace policy: https://github.com/stlab/cpp-library/blob/v5.8.1/cmake/cpp-library-install.cmake#L459-L475
- Original installation-control change: Enable install in non-top-level projects via NAMESPACE_INSTALL #22
- Independent nested installation support: Support independent nested installs and Windows DLL consumers #27
- CEL client ordering: https://github.com/stlab/cel-std/blob/main/CMakeLists.txt
Activity
sean-parent commentedon Nov 15, 2026
Recommendation: defer this issue and leave it open. The ordering gap was found during review, and no client has reported it as a problem. An early initializer would replace a manual
option()with another installation-specific call and ordering requirement, without meaningfully reducing client CMake.Installation workflows are strongly discouraged in favor of CPM. Installing a component does not generally install its dependencies; the client or package manager is responsible for making them available. The generated CMake package configuration records dependency information for explicit installation workflows, but is not a self-contained dependency bundle. Installation support should have minimal impact on clients following the recommended source-consumption workflow.
For an explicit installation, callers can set the shared option at configure time (for example,
-DCEL_INSTALL=ON). This can enable install rules for other packages sharing the option; it does not ensure dependencies are available. Independent packages can useINSTALL_OPTION.Revisit this issue if a client reports a concrete problem or a solution removes the ordering hazard without extra installation-specific client boilerplate or breaking existing choices. Preserve the existing installation controls and independently installed nested-package support; they were added for package-manager and standalone extraction workflows (#22 and #27).