Skip to content

Add default-on portable thread support - #62

Merged
sean-parent merged 1 commit into
mainfrom
issue-57-thread-support
Nov 21, 2026
Merged

sean-parent merged 1 commit into
mainfrom
issue-57-thread-support

Conversation

@sean-parent

Copy link
Copy Markdown
Member

Summary

  • Add cpp_library_setup(ENABLE_THREADS ON|OFF), defaulting to ON. Production libraries, generated tests/examples, in-source runners, and downstream consumers inherit Threads::Threads; installed packages declare find_dependency(Threads).
  • ENABLE_THREADS OFF skips automatic thread discovery and linkage. Production support also applies in lightweight subproject mode without adding development targets.
  • Fix deferred system dependency resolution when setup runs inside a function.
  • Private src/ header access for generated tests was already implemented and remains private.

Fixes #57.

Test plan

Fresh local runs on macOS arm64 with CMake 4.5.1, Ninja 1.13.2, and AppleClang 21. Commands come from .github/workflows/ci.yml and the repository instructions. Compiled fixture scripts configure and build before executing their tests; this repository has no root library build or applicable root consumer presets.

  • cmake -P tests/install/CMakeLists.txt — dependency mapping/provider harness; no failures. The harness retains its existing intentional skip for a fatal-error case.
  • cmake -P tests/install/test_provider_merge.cmake — provider merging.
  • cmake -P tests/install/test_nested_install.cmake — existing static/shared build, install, and downstream round trips; 19 cases passed.
  • cmake -P tests/install/test_package_ci.cmake — generated package checks, including function-scoped setup.
  • cmake -P tests/setup/test_target_type.cmake — 20 cases passed, including default/explicit ON, OFF, header-only/static/shared libraries, subprojects, disabled testing, missing values, standard thread execution, and a forced real FindThreads -pthread path. The three disabled-development cases intentionally have no CTest tests; their builds and target-absence assertions pass.
  • cmake -P tests/setup/test_header_checks.cmake — independent public-header compilation and isolation.
  • cmake -P tests/setup/test_source_testing.cmake — static and in-source test execution.
  • cmake -P tests/setup/test_version_override.cmake — project version overrides.
  • cmake -P tests/setup/test_install_dirs.cmake — installation directory behavior.
  • cmake -P tests/setup/test_runtime_dlls.cmake — runtime deployment helper checks applicable to this host.
  • cmake -P tests/setup/test_setup_version_resolution.cmake — scaffold version resolution.
  • cmake -DCPP_LIBRARY_TEST_CLANGD=ON -DCPP_LIBRARY_TEST_COMPILER_ID=AppleClang -P tests/setup/test_clangd.cmake — fresh clangd navigation and configure-time indexing.
  • cmake -P tests/docs/test_docs.cmake — documentation configuration/rendering; 18 cases passed.
  • git diff --check — clean. The repository workflow defines no separate format/lint gate for CMake scripts or README prose.
  • Repository ci.yml jobs — Linux execution, Windows/MSVC and DLL coverage, cross-platform clangd matrix, and the workflow's scaffold/CPM integration remain pending CI.

Generated with GitHub Copilot CLI

Add ENABLE_THREADS to cpp_library_setup and propagate Threads::Threads through production and development targets. Keep deferred system dependency resolution valid when setup runs inside a function, and extend regression coverage and documentation.

Fixes #57

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

@sean-parent sean-parent left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Talos review — complete

Verdict: No actionable issues found at b484c06fda4a13330c63832833acf6deff526d9f against main (merge base 7e8dfba4d5cf01bb43bd0ed7df5db21d25ec1653). This is a local Talos review published by Copilot CLI, not an approval.

Files Reviewers Candidates → validated → accepted Posted Overflow Tests
6 of 6 6 personas plus challenge 0 → 0 → 0 0 inline, summary published 0 13 repository-native script regressions passed locally

Security, correctness, standards, architecture, operations, and documentation personas completed independently, followed by the challenge step. No candidates were dropped, no latent findings remain, and there are no duplicate findings or recurrences to post.

Reviewed paths: README.md, cmake/cpp-library-install.cmake, cpp-library.cmake, tests/install/test_nested_install.cmake, tests/setup/fixtures/target_type/CMakeLists.txt, and tests/setup/test_target_type.cmake. Project context used CLAUDE.md and the applicable repository-wide GitHub custom instructions at the base commit; no rule files were skipped.

Verification covers dependency mapping and merging, existing nested static/shared installation round trips, generated package checks, target types and threads (20 cases, including a real forced -pthread path), independent public-header checks, in-source execution, version overrides, install directories, runtime deployment, scaffold version resolution, fresh clangd navigation, and documentation rendering (18 cases). The disabled-development fixtures intentionally contain no runtime tests; their configure/build and absent-target assertions were verified. Windows/MSVC and Windows DLL execution were not run locally and remain CI coverage. No separate CMake/README format or lint gate is configured in the repository workflow; git diff --check passed.

Persona routing: static roster (DCAP routing off; rerun with --dcap to enable).

Org knowledge: off (rerun with --knowledge).

Scout

Used: risk MEDIUM, evidence LOW, status COMPLETE (scout 0.9.135, <1s).
Cross-file leads given to reviewers: 0 changed symbol(s) with uses outside the diff, 0 new value(s) not handled everywhere, 0 possibly unused symbol(s).
Scout rated its evidence LOW for this change; reviewers used it only as leads.

Scout could not map this change to specific symbols, so its affected-test list (based on whole files) is left out. From the repository root, run scout affected-tests -r . -s compare -b main.

@sean-parent
sean-parent merged commit 1600ce3 into main Nov 21, 2026
7 checks passed
@sean-parent
sean-parent deleted the issue-57-thread-support branch November 21, 2026 05:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Centralize private test-header access and standard-thread build requirements

1 participant