ecmwf / ecbuild

A CMake-based build system, consisting of a collection of CMake macros and functions that ease the managing of software build systems
https://ecbuild.readthedocs.io
Apache License 2.0
26 stars 25 forks source link

Improved FindNetCDF.cmake #26

Closed markjolah closed 4 years ago

markjolah commented 4 years ago

This version of FindNetCDF.cmake uses the nc-config, nf-config and ncxx4-config to set the appropriate paths and flags for linking against the various NetCDF language components. This allows linking against static NetCDF installs, and linking on systems where each language component is installed to a separate prefix (as occurs in some HPC environment module based systems). The current FindNetCDF.cmake does not work for these scenarios.

In order to ensure the user links against the namespaced imported interface targets NetCDF::NetCDF_<LANG> targets, we have deprecated the NetCDF_LIBRARIES variable, but it should still work for packages already using that variable. It now points to the imported interface targets for each searched component.

oiffrig commented 4 years ago

Thanks for this PR. We are currently preparing a new major release of ecbuild, and will include these changes in the process.