Skip to content

Use find_dependency in PackageConfig.cmake.in? #829

@AlexanderRichert-NOAA

Description

@AlexanderRichert-NOAA

tl;dr I think we should add a find_dependency to PackageConfig.cmake.in for each corresponding find_package in CMakeLists.txt.

I don't know if we've specifically discussed whether package dependencies should automatically be propagated in CMake configs for use by downstream codes, so if we haven't then I suggest discussing here and applying a consistent approach approach NCEPLIBS.

Currently, building grib_util with the heads of develop for g2 and g2c fails because the grib_util CMake config doesn't know to look for g2c. I think that the best solution is for g2's PackageConfig.cmake.in to include find_dependency(g2c) so that the dependency is automatically propagated to CMake projects that use g2, including grib_util. This approach minimizes redundancy (avoids downstream packages needing to define those dependencies) and, maybe more importantly, it makes conditional dependency handling easy-- if package A only sometimes depends on package B depending on some build option in package A's CMakeLists.txt, then package C isn't forced to unnecessarily install and find package B if their package A installation was configured without it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions