Skip to content

refactor(build): remove USE_LEGACY_BUILD auto-detection branching #685

Description

@kcenon

What

Remove the USE_LEGACY_BUILD auto-detection branching from cmake/thread_system_targets.cmake and the submodule fallback path in the root CMakeLists.txt. Commit the project to the single, standard layout (include/kcenon/thread/ + src/).

Part of #683. Depends on sub-issue A (header migration must complete first).

Why

The auto-detection logic exists only to support the dual layout. Once sub-issue A lands, every header lives under include/kcenon/thread/ and every translation unit lives under src/. The branching becomes pure dead weight:

  • create_thread_system_targets() (cmake/thread_system_targets.cmake:23-92) — runtime detection of include/kcenon/thread and source count
  • add_legacy_subdirectories() (cmake/thread_system_targets.cmake:97-117) — add_subdirectory for utilities/, interfaces/, core/, implementations/
  • CMakeLists.txt:188-200 — submodule fallback that still drives add_subdirectory(interfaces) etc.

Removing it lets new contributors read the build script linearly instead of tracing through hybrid-mode escape hatches.

How

  1. After sub-issue A merges, delete the legacy interfaces/, utilities/, core/ directories at the repository root (now containing only forwarding stubs and CMakeLists.txt).
  2. Strip USE_LEGACY_BUILD PARENT_SCOPE assignments from create_thread_system_targets(). Always create thread_system as the static library from include/kcenon/thread/ + src/.
  3. Delete the add_legacy_subdirectories() function and its call site (CMakeLists.txt:153-155).
  4. Replace the submodule branch (CMakeLists.txt:188-200) with a single add_library(thread_system STATIC ...) based on the standard layout.
  5. Drop the thread_base, utilities, interfaces ALIAS targets if unused, or keep them as pure aliases over thread_system (decide based on grep -rn of dependent repos).
  6. Run all CMake presets locally: default, debug, release, core-debug, core-release, asan, tsan, ubsan, ci, vcpkg.

Acceptance Criteria

  • cmake/thread_system_targets.cmake contains a single non-branching target creation path
  • No reference to USE_LEGACY_BUILD remains in any cmake module
  • add_legacy_subdirectories is deleted
  • Submodule path in CMakeLists.txt does not call add_subdirectory(interfaces|utilities|core)
  • All listed presets configure and build successfully on the local platform
  • CI matrix passes on the resulting PR

Where

Path Action
cmake/thread_system_targets.cmake Strip USE_LEGACY_BUILD logic, delete add_legacy_subdirectories
CMakeLists.txt Remove if(USE_LEGACY_BUILD) add_legacy_subdirectories() and submodule legacy branch
cmake/thread_system_install.cmake Audit if(USE_LEGACY_BUILD) guard at line 66 — remove
interfaces/, utilities/, core/ (root) Delete after forwarding stubs no longer referenced

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions