Conversation
…e modules
Split the 609-line top-level CMakeLists.txt into 7 focused modules
(options, compiler, dependencies, install, tests, samples, summary)
under cmake/. The top-level file is reduced to 64 lines containing
only cmake_minimum_required, project(), CMAKE_MODULE_PATH, and ordered
include() calls plus the if(BUILD_DATABASE) add_subdirectory(src) gate.
Module breakdown (all <= 150 lines):
- cmake/options.cmake (73) all 18 option() declarations,
experimental backend warnings, and
the BUILD_INTEGRATION_TESTS override.
- cmake/compiler.cmake (111) CXX standard, output dirs, debug
flags, platform definitions, optional
coroutine probe, ENABLE_COVERAGE.
- cmake/dependencies.cmake (148) FindSystemDependency helper, Threads,
OpenSSL, ASIO version probe, and
common/thread/monitoring/container
ecosystem integration.
- cmake/install.cmake (143) GNUInstallDirs, tiered install
degradation, header install (incl.
the issue-#582 legacy shim install
gated by DATABASE_DISABLE_LEGACY_HEADERS),
target export, package config files.
- cmake/tests.cmake (27) enable_testing() and the unit-test,
benchmark, and integration-test
add_subdirectory() wiring.
- cmake/samples.cmake (18) samples and examples add_subdirectory
gated by their respective options.
- cmake/summary.cmake (87) human-readable build configuration
summary printed last.
No semantic change: build graph, target list, install paths, CTest
discovery, and option defaults are all preserved. Ordering invariants
(project() before find_package, CMAKE_MODULE_PATH before
include(FindSystemDependency), GNUInstallDirs before
${CMAKE_INSTALL_INCLUDEDIR} use, install rules after add_subdirectory(src),
summary last) are maintained.
Counts verified pre/post:
option(): 18 / 18
find_package(): 3 / 3
install(): 6 / 6
add_subdirectory(): 6 / 6
Existing cmake/FindSystemDependency.cmake and
cmake/database_system-config.cmake.in are unchanged.
Part of #577. Closes #581.
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 609-line top-level
CMakeLists.txtinto 7 focusedcmake/*.cmakemodules. The top-level file is reduced to 64 lines containing onlycmake_minimum_required,project(),CMAKE_MODULE_PATHsetup, and orderedinclude(...)calls.Closes #581.
Part of #577.
Why
A 600+ line top-level
CMakeLists.txtis hard to review and edit. Per-concern modules letgit diffclearly show which axis of the build (e.g., install rules vs. test discovery) a PR touches, and the canonical kcenon template enforces ordering invariants (project → options → dependencies → targets → tests → install) that prevent subtle bugs.How
cmake/*.cmakemodules created:cmake/options.cmakeoption(...)declarations grouped by category, plusBUILD_INTEGRATION_TESTScache fixupcmake/compiler.cmakeCheckCXXSourceCompilescmake/dependencies.cmakeFindSystemDependencyinclude +find_package(Threads), asio, OpenSSL, dependency probescmake/install.cmakeGNUInstallDirs, allinstall(...)rules, package config generation, D5 legacy-shim install (preserved byte-equivalent)cmake/tests.cmakeenable_testing(), top-level test wiringcmake/samples.cmakeadd_subdirectoryfor samples/examplescmake/summary.cmake*_FOUNDflags settledcmake/FindSystemDependency.cmake(165 lines) andcmake/database_system-config.cmake.inleft unchanged.CMakeLists.txt(64 lines) consists of:cmake_minimum_required+project()+list(APPEND CMAKE_MODULE_PATH ...)+ orderedinclude()calls +add_subdirectory(src)and conditionaltests/samples.summary.cmake) was added beyond the plan's 6 because the build-configuration summary block (~78 lines) cannot be merged intoinstall.cmakewithout exceeding the 150-line cap, and semantically it's status reporting unrelated to install rules.What was deliberately preserved
project()before anyfind_package,CMAKE_MODULE_PATHappend beforeinclude(FindSystemDependency),GNUInstallDirsbefore any${CMAKE_INSTALL_INCLUDEDIR}consumer,add_subdirectory(src)before install rules, summary last.if(NOT DATABASE_DISABLE_LEGACY_HEADERS)) byte-equivalent ininstall.cmake.option()defaults, 3find_packagecalls, 6install(...)calls, 6add_subdirectory(...)calls.Where
CMakeLists.txtcmake/options.cmakecmake/compiler.cmakecmake/dependencies.cmakecmake/install.cmakecmake/tests.cmakecmake/samples.cmakecmake/summary.cmakecmake/FindSystemDependency.cmakecmake/database_system-config.cmake.insrc/CMakeLists.txt,tests/CMakeLists.txtTest Plan
Notes for Reviewers
option(...)default,find_packagecall,install(...)rule, andadd_subdirectory(...)line was copied verbatim into the corresponding module. Counts checked: 18 options, 3 find_package, 6 install, 6 add_subdirectory.summary.cmakecouldn't merge intoinstall.cmakewithout breaking the 150-line cap. The acceptance criterion ("≤ 150 lines per module") is met.grep -c '^option('). Likely an off-by-one in the issue body when written. Functional content preserved.src/CMakeLists.txtnot touched: D4 scope per issue body is top-level only.src/CMakeLists.txt(648 lines) could be a candidate for a future decomposition issue but is explicitly out of scope here.Rollback
git revertof this single squash-merge commit fully restores the monolithic 609-lineCMakeLists.txt. No build behavior change so revert is symmetric.