Skip to content

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

Description

@kcenon

What

Change the CMake config install destination from lib/cmake/NetworkSystem to
lib/cmake/network_system so find_package(network_system CONFIG) resolves natively.

Why

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

Currently the portfile must work around this with a wrapper config file:

# vcpkg-ports/kcenon-network-system/portfile.cmake (wrapper workaround)
vcpkg_cmake_config_fixup(
    PACKAGE_NAME network_system
    CONFIG_PATH lib/cmake/NetworkSystem   # <-- PascalCase upstream path
)
file(WRITE ".../network_system-config.cmake"
    "include(\".../NetworkSystemConfig.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(network_system CONFIG) works directly from the installed cmake directory
  • No wrapper config file needed in the vcpkg portfile
  • NetworkSystem::NetworkSystem target still usable (target namespace unchanged)
  • Existing consumers' target_link_libraries(... NetworkSystem::NetworkSystem) still compile

Implementation

In CMakeLists.txt:

# Before
install(EXPORT NetworkSystemTargets
    NAMESPACE NetworkSystem::
    DESTINATION lib/cmake/NetworkSystem
)
configure_package_config_file(... INSTALL_DESTINATION lib/cmake/NetworkSystem)

# After
install(EXPORT NetworkSystemTargets
    NAMESPACE NetworkSystem::
    DESTINATION lib/cmake/network_system
)
configure_package_config_file(... INSTALL_DESTINATION lib/cmake/network_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