Skip to content

feat(cmake): adopt snake_case install(EXPORT) name for vcpkg compatibility #502

Description

@kcenon

What

Change the CMake install(EXPORT) name from LoggerSystemTargets to logger_system_targets,
and update the install(PACKAGE_CONFIG_FILE) to install as logger_system-config.cmake.

Why

The monitoring_system vcpkg overlay ports standardized on snake_case PACKAGE_NAME
to match vcpkg port naming conventions (kcenon-logger-systemlogger_system).

Currently the portfile at kcenon/monitoring_system must work around this with a
wrapper config file:

# vcpkg-ports/kcenon-logger-system/portfile.cmake (wrapper workaround)
vcpkg_cmake_config_fixup(
    PACKAGE_NAME logger_system
    CONFIG_PATH lib/cmake/LoggerSystem   # <-- PascalCase upstream path
)
file(WRITE ".../logger_system-config.cmake"
    "include(\".../LoggerSystemConfig.cmake\")\n"  # <-- indirection wrapper
)

Once this upstream adopts snake_case natively, the CONFIG_PATH override and
wrapper file in the portfile can be removed.

Where

How

Acceptance Criteria

  • find_package(logger_system CONFIG) works directly from the installed cmake directory
  • No wrapper config file needed in the vcpkg portfile
  • LoggerSystem::LoggerSystem target still usable (target namespace unchanged)
  • Existing consumers' target_link_libraries(... LoggerSystem::LoggerSystem) still compile

Implementation

In CMakeLists.txt:

# Before
install(EXPORT LoggerSystemTargets
    NAMESPACE LoggerSystem::
    DESTINATION lib/cmake/LoggerSystem
)
configure_package_config_file(... INSTALL_DESTINATION lib/cmake/LoggerSystem)

# After
install(EXPORT LoggerSystemTargets
    NAMESPACE LoggerSystem::
    DESTINATION lib/cmake/logger_system
)
configure_package_config_file(... INSTALL_DESTINATION lib/cmake/logger_system)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions