Skip to content

fix(cmake): Change common_system find_dependency from QUIET to REQUIRED in config template #462

Description

@kcenon

Part of kcenon/common_system#454

What

cmake/database_system-config.cmake.in declares common_system as QUIET in find_dependency, but the build-time CMakeLists.txt treats it as FATAL_ERROR if missing.

  • Current: find_dependency(common_system CONFIG QUIET) — silently proceeds if common_system is not installed
  • Expected: find_dependency(common_system CONFIG REQUIRED) — fails immediately with a clear error
  • Scope: cmake/database_system-config.cmake.in line 36

Why

When a consumer installs database_system via vcpkg and common_system is somehow missing (e.g., manual install without transitive deps), find_package(database_system CONFIG) will silently skip common_system. The consumer then gets cryptic linker errors instead of a clear "common_system not found" configure-time error.

At build time, CMakeLists.txt enforces common_system as mandatory:

if(NOT common_system_FOUND)
    message(FATAL_ERROR "common_system not found! database_system requires common_system v1.0+.")
endif()

The installed config template should reflect this same requirement level.

Additionally, container_system is also declared QUIET on line 39 but may warrant the same change depending on whether the USE_CONTAINER_SYSTEM option is active.

Where

  • cmake/database_system-config.cmake.in — line 36: find_dependency(common_system CONFIG QUIET)
  • cmake/database_system-config.cmake.in — line 39: find_dependency(container_system CONFIG QUIET) (secondary)
  • CMakeLists.txt — line ~235: find_system_dependency(common_system) with FATAL_ERROR on failure

How

Technical Approach

  1. Change line 36 of cmake/database_system-config.cmake.in:

    # Before
    find_dependency(common_system CONFIG QUIET)
    # After
    find_dependency(common_system CONFIG REQUIRED)
  2. Optionally, make container_system conditional on the build-time feature flag:

    set(_DATABASE_USE_CONTAINER @USE_CONTAINER_SYSTEM@)
    if(_DATABASE_USE_CONTAINER)
        find_dependency(container_system CONFIG REQUIRED)
    endif()

Acceptance Criteria

  • find_dependency(common_system CONFIG REQUIRED) in installed config template
  • find_package(database_system CONFIG) fails immediately with a clear error when common_system is not installed
  • No regression when all dependencies are correctly installed
  • container_system dependency is conditional on build-time USE_CONTAINER_SYSTEM flag

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions