refactor(build): decompose CMakeLists.txt into cmake/ modules#540
Merged
refactor(build): decompose CMakeLists.txt into cmake/ modules#540
Conversation
Split the 743-line top-level CMakeLists.txt into per-concern modules under
cmake/, leaving the root file as a 49-line orchestrator that declares the
project and includes the modules in dependency order.
New / extended modules:
- cmake/options.cmake option() declarations and feature toggles
- cmake/compile_options.cmake language standards, output dirs, warning
helpers (apply_container_compile_options,
apply_container_simd_definitions)
- cmake/dependencies.cmake Threads + common_system imported target
wiring (configure_container_common_system_dep)
- cmake/sources.cmake source/header file lists
- cmake/targets.cmake add_library(container_system) + flags +
defs + links
- cmake/modules.cmake optional C++20 module library target
- cmake/test.cmake unit / integration / fuzz registration
- cmake/documentation.cmake Doxygen target wiring
- cmake/samples.cmake samples / examples / benchmarks
subdirectories
- cmake/install.cmake install rules + package config generation
- cmake/summary.cmake end-of-configure status print
Existing cmake/UnifiedDependencies.cmake, cmake/Version.cmake,
cmake/container_system-config.cmake.in and cmake/toolchain-arm64-linux.cmake
are unchanged.
Behaviour parity is the explicit goal: every install destination,
component, pattern filter, compile flag, definition, and target alias is
preserved verbatim from the legacy file. No options were added, removed,
or renamed. No build artefact name changes. The Doxygen layout and
install layout review remain owned by issue #536.
Closes #535
Part of #531
This was referenced May 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Decompose the 743-line top-level
CMakeLists.txtinto per-concern modules undercmake/, leaving the root file as a 49-line orchestrator.Module map
cmake/options.cmakeoption()declarations and feature togglescmake/compile_options.cmakecmake/dependencies.cmakecmake/sources.cmakecmake/targets.cmakeadd_library(container_system)+ flags + defs + linkscmake/modules.cmakecmake/test.cmakecmake/documentation.cmakecmake/samples.cmakecmake/install.cmakecmake/summary.cmakeExisting
cmake/UnifiedDependencies.cmake,cmake/Version.cmake,cmake/container_system-config.cmake.in, andcmake/toolchain-arm64-linux.cmakeare unchanged.Why
A 743-line top-level CMakeLists is hard to review and prone to merge conflicts every time options/dependencies/install rules change. Sibling repos in the EPIC already use a per-concern cmake-module layout. Aligning container_system removes a recurring friction point for cross-repo refactors and makes future changes scoped.
How
Behaviour parity
The mechanical relocation preserves every install destination, component, pattern filter, compile flag, definition, and target alias verbatim from the legacy file. No options were added, removed, or renamed. No build artefact name changes. The Doxygen layout and install layout review remain owned by issue #536.
Two helper functions extracted
apply_container_compile_options(<target>)(incmake/compile_options.cmake) bundles the warning suppressions, standard warning set, Clang-specific tweaks, and Windows definitions into a single reusable hook. The static library target consumes it fromcmake/targets.cmake. The C++20 module target incmake/modules.cmakedoes not currently call it (matching legacy behaviour) but the helper is available if a future change wants identical flags applied there too.apply_container_simd_definitions(<target>)(incmake/compile_options.cmake) detects compiler SIMD support and applies HAS_AVX2 / HAS_SSE42 / HAS_ARM_NEON private compile definitions. It re-exportsCOMPILER_SUPPORTS_AVX2andCOMPILER_SUPPORTS_SSE42to the parent scope socmake/summary.cmakecan read the detection results without re-running the checks.configure_container_common_system_dep(<target>)(incmake/dependencies.cmake) encapsulates theunified_find_dependency(common_system)call plus the kcenon::common_system imported INTERFACE target creation, with the same inline copy-properties logic the legacy file used.Acceptance Criteria
CMakeLists.txt≤ ~80 lines (49 lines after refactor, was 743)cmake/<area>.cmakecmake -S . -B build && cmake --build buildsucceeds (verified via CI — local toolchain unavailable in sandbox)installstill produces the same export layout (no destinations or rules changed; verified by reading the diff)Test Plan
develop, behaviour parity is confirmed.workflow/ci-resilience.md(toolchain fallback).Closes #535
Part of #531