Skip to content

fix(cmake): Enable thread_system integration in vcpkg build mode #507

Description

@kcenon

What

Enable LOGGER_USE_THREAD_SYSTEM=ON in vcpkg build mode so that logger_system
can use thread_system's thread pool executor instead of falling back to the
standalone std::jthread-based executor.

Currently the vcpkg portfile forces -DLOGGER_USE_THREAD_SYSTEM=OFF as a
workaround for unresolved externals when linking thread_pool symbols.

Why

When LOGGER_USE_THREAD_SYSTEM=OFF, logger_system falls back to its standalone
async executor. This means:

  • Users who install both kcenon-logger-system and kcenon-thread-system via
    vcpkg cannot benefit from thread_system's optimized thread pool (work stealing,
    lock-free queues) for log dispatch.
  • The monitoring_system and network_system portfiles that depend on both
    logger_system and thread_system cannot achieve unified thread management.

The root cause is a CMake export/config issue, not an architectural problem:

  1. logger_system-config.cmake.in uses find_dependency(thread_system QUIET)
    silent failure masks missing dependency.
  2. Transitive dependency propagation in the export set may be incomplete when
    thread_system sub-targets (e.g., thread_base) are not fully declared.

Where

  • CMakeLists.txt — lines 408–450 (thread_system linking logic)
  • cmake/logger_system-config.cmake.in — lines 20–31 (find_dependency calls)
  • vcpkg portfile: vcpkg-registry/ports/kcenon-logger-system/portfile.cmake line 23

How

Acceptance Criteria

  • vcpkg build with -DLOGGER_USE_THREAD_SYSTEM=ON succeeds on all CI platforms
  • Consumer project can find_package(logger_system) and link without unresolved symbols
  • LOGGER_HAS_THREAD_SYSTEM compile definition is propagated to consumers
  • Fallback to standalone executor still works when thread_system is not available

Technical Approach

  1. Fix logger_system-config.cmake.in: Change find_dependency(thread_system QUIET)
    to find_dependency(thread_system CONFIG REQUIRED) when LoggerSystem_USE_THREAD_SYSTEM
    is ON, ensuring transitive dependencies are resolved at consume-time.

  2. Verify export set: Ensure install(TARGETS ... EXPORT logger_system-targets) properly
    includes the PUBLIC dependency on thread_system when it is an IMPORTED target.

  3. Update portfile: Remove -DLOGGER_USE_THREAD_SYSTEM=OFF override and add
    kcenon-thread-system as a required dependency in the port's vcpkg.json.

  4. CI verification: Add a consumer integration test that links both logger_system and
    thread_system and calls logger APIs.

Related

  • vcpkg portfile workaround: vcpkg-registry/ports/kcenon-logger-system/portfile.cmake:12-23
  • thread_system config: thread_system/cmake/thread_system-config.cmake.in
  • Previous bidirectional dependency resolution: CMakeLists.txt:209-221

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingbuildBuild system (CMake, etc)dependenciesDependency updates and managementpriority:highHigh priority issue

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions