What
Decompose the 1031-line root CMakeLists.txt by extracting inline directives into modular cmake/*.cmake files following the existing network_system_*.cmake naming convention.
Part of #1083.
Current state
- Root
CMakeLists.txt: 1031 lines.
cmake/ already has 5 modular files: network_system_dependencies.cmake, network_system_features.cmake, network_system_install.cmake, network_system_integration.cmake, network_system_cpack.cmake.
- The remaining inline content includes ~24
option(...) declarations, compiler/standard setup, sanitizer wiring, ASIO recycling workaround, the main add_library(network_system ...) target rule (line 432), summary message(STATUS ...) block (lines 994-end).
Why
A 1031-line root file is the most bloated in the ecosystem (Master EPIC kcenon/common_system#657). Extraction recovers reviewability and makes future option additions a single-file diff instead of a search-and-insert into a wall of text.
Where
CMakeLists.txt (slim down to thin orchestrator)
cmake/ (new modules)
How
Technical approach
Extract inline directives into new modules using existing naming convention:
cmake/network_system_options.cmake — all option(...) declarations (~24)
cmake/network_system_compiler.cmake — C++ standard, CMAKE_POSITION_INDEPENDENT_CODE, compile-feature defaults
cmake/network_system_sanitizers.cmake — ASAN/TSAN/UBSAN flag wiring (mutually-exclusive enforcement)
cmake/network_system_targets.cmake — network_system library target rule + network-integration-objects + alias
cmake/network_system_summary.cmake — final message(STATUS ...) configuration printout
Root CMakeLists.txt becomes:
cmake_minimum_required(VERSION 3.20)
project(network_system VERSION 0.1.1 ...)
include(cmake/network_system_options.cmake)
include(cmake/network_system_compiler.cmake)
include(cmake/network_system_sanitizers.cmake)
include(cmake/network_system_dependencies.cmake)
include(cmake/network_system_targets.cmake)
include(cmake/network_system_features.cmake)
include(cmake/network_system_integration.cmake)
include(cmake/network_system_install.cmake)
include(cmake/network_system_cpack.cmake)
include(cmake/network_system_summary.cmake)
add_subdirectory(libs)
if(BUILD_TESTS) add_subdirectory(tests) endif()
# ... etc
Verification approach
For each extraction step:
- Diff the option list before vs after (no option silently dropped)
- Verify build matrix unchanged: default +
-DBUILD_SAMPLES=ON -DBUILD_EXAMPLES=ON -DENABLE_ASAN=ON
- Verify install layout unchanged via
cmake --install build/ --prefix /tmp/inst-after diff
- Verify downstream
pacs_system build still succeeds (cross-build CI gate from Master EPIC)
Acceptance criteria
What
Decompose the 1031-line root
CMakeLists.txtby extracting inline directives into modularcmake/*.cmakefiles following the existingnetwork_system_*.cmakenaming convention.Part of #1083.
Current state
CMakeLists.txt: 1031 lines.cmake/already has 5 modular files:network_system_dependencies.cmake,network_system_features.cmake,network_system_install.cmake,network_system_integration.cmake,network_system_cpack.cmake.option(...)declarations, compiler/standard setup, sanitizer wiring, ASIO recycling workaround, the mainadd_library(network_system ...)target rule (line 432), summarymessage(STATUS ...)block (lines 994-end).Why
A 1031-line root file is the most bloated in the ecosystem (Master EPIC kcenon/common_system#657). Extraction recovers reviewability and makes future option additions a single-file diff instead of a search-and-insert into a wall of text.
Where
CMakeLists.txt(slim down to thin orchestrator)cmake/(new modules)How
Technical approach
Extract inline directives into new modules using existing naming convention:
cmake/network_system_options.cmake— alloption(...)declarations (~24)cmake/network_system_compiler.cmake— C++ standard,CMAKE_POSITION_INDEPENDENT_CODE, compile-feature defaultscmake/network_system_sanitizers.cmake— ASAN/TSAN/UBSAN flag wiring (mutually-exclusive enforcement)cmake/network_system_targets.cmake—network_systemlibrary target rule +network-integration-objects+ aliascmake/network_system_summary.cmake— finalmessage(STATUS ...)configuration printoutRoot
CMakeLists.txtbecomes:Verification approach
For each extraction step:
-DBUILD_SAMPLES=ON -DBUILD_EXAMPLES=ON -DENABLE_ASAN=ONcmake --install build/ --prefix /tmp/inst-afterdiffpacs_systembuild still succeeds (cross-build CI gate from Master EPIC)Acceptance criteria
CMakeLists.txt≤ 150 lines (orchestrator only)network_system_*.cmakenamingpacsbuilds unchanged