Skip to content

[#674-2/5] Remove legacy CMake fallback branch #676

Description

@kcenon

What

Identify and remove the legacy/new dual-structure branch in the 996-line root CMakeLists.txt. Leave a single, canonical CMake build path. After this PR, no part of CMakeLists.txt (or any module it include()s) maintains a "legacy fallback" code path.

Why

The root CMakeLists.txt is bloated to 996 lines primarily because it carries two parallel build configurations: the new structured layout and a legacy fallback that activates when the new layout is "missing." After sub-issue # stabilises the source layout, the fallback branch can never trigger in normal builds — keeping it alive only adds review burden, drift surface, and confusion.

Removing the fallback is the single biggest win toward the EPIC's "decompose CMake" objective: it slashes the file by an estimated 30–40% before any other refactor.

Where

  • CMakeLists.txt (the legacy/new branching is in the root file, but verify whether any module it include()s carries duplicated branches)
  • Possibly cmake/<existing>.cmake modules if they mirror the dual structure

How

Technical Approach

  1. Read CMakeLists.txt end-to-end and tag the legacy/fallback branches. Common signatures: if(EXISTS ...) checks for the old paths, else() branches that name core/, internal/, etc., redundant add_library(...) calls inside an if/else.
  2. Confirm with git log --follow CMakeLists.txt that the fallback was added in a known migration commit and is safe to remove.
  3. Delete the fallback branch and any surrounding scaffolding (cached variables, comment blocks describing the dual layout).
  4. Verify the remaining single path still builds end-to-end.
  5. Do NOT replace any of the structured logic with new patterns; this PR is a deletion, not a redesign. Replacing the hardcoded source list with globbing belongs to sub-issue #; the full CMake decomposition belongs to sub-issue #.

Dependencies

  • Blocked by: src/impl consolidation sub-issue (must merge first so the fallback's path references are no longer load-bearing).

Acceptance Criteria

  • No if(...legacy...) / if(EXISTS old_path) branches remain in CMakeLists.txt
  • Single build path; only one set of add_library(...) calls per target
  • Build green, ctest passes
  • Line count of CMakeLists.txt measurably reduced (target: at least 200 lines off — concrete number reported in PR body)

Estimated Size

M. Deletion-only at the syntax level, but the legacy branch is interleaved with structured logic — careful reading required.

Part of #674

Metadata

Metadata

Assignees

Labels

priority/highHigh priority - Critical for productionsize/MMedium - 1-3 days of worktype/buildBuild system and dependenciestype/refactorCode refactoring without functional changes

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions