Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question about whether CMake build provides proper package config file... #1733

Closed
edwardhartnett opened this issue May 20, 2020 · 8 comments
Assignees
Milestone

Comments

@edwardhartnett
Copy link
Contributor

I have this question from a fellow NOAA programmer about the CMake config file for netcdf-c:

The CMake build of NetCDF (C, Fortran and C++) do not provide a correct package config file. In other words, I never had success with find_package(NetCDF C Fortran C++) using the package config file provided by the NetCDF package. This is the reason I (and some others) have been using the old configure based build system and came up with our version of FindNetCDF.cmake that relies on nc-config, nf-config, ncxx4-config.

@zerothi
Copy link

zerothi commented Oct 25, 2022

I would really second this!!

It would be super fantastic if netcdf installed a cmake and pkg-config file for end users!

@edwardhartnett
Copy link
Contributor Author

What would be helpful is if some cmake-expert netCDF users would submit a PR with these fixes...

@ibaned
Copy link
Contributor

ibaned commented Oct 25, 2022

Hi all,

We're using NetCDF with the CMake config file, one difference is the name is netCDF not NetCDF so find_package(netCDF CONFIG) works for us. We have a few nitpicks about transitive dependence on HDF5 but overall it does work okay.

@WardF
Copy link
Member

WardF commented Oct 25, 2022

Good to know about the case-sensitivity re: FIND_PACKAGE(netCDF ...). Our documentation for using cmake-based netCDF, not just building via cmake, certainly could use some updating/creating. Thanks!

@WardF WardF added this to the 4.9.1 milestone Oct 25, 2022
@WardF WardF self-assigned this Oct 25, 2022
@WardF
Copy link
Member

WardF commented Oct 25, 2022

I would really second this!!

It would be super fantastic if netcdf installed a cmake and pkg-config file for end users!

For the record, netCDF does install a pkg-config file, whether you are building via cmake or configure && make, etc. It also provides the nc-config command line utility which can be queried directly, in addition to the above.

The weakest part of the install are the files used to pull netCDF into other cmake-based projects. As @edwardhartnett said, a PR would be great, but I'll also come up to speed on what it will take to incorporate more of the modern functionality (as opposed to the cmake v2.8 functionality we used when cmake was originally integrated into netcdf).

Thanks :)

@WardF
Copy link
Member

WardF commented Oct 25, 2022

Hi all,

We're using NetCDF with the CMake config file, one difference is the name is netCDF not NetCDF so find_package(netCDF CONFIG) works for us. We have a few nitpicks about transitive dependence on HDF5 but overall it does work okay.

Hi @ibaned, are the nitpicks that the transitive dependence is present in the first place? Or is there something we can clean up there to make it more functional?

@ibaned
Copy link
Contributor

ibaned commented Oct 25, 2022

@WardF I believe the canonical advice in CMake is that netCDFConfig.cmake should call something like

find_dependency(HDF5)

if NetCDF is built with HDF5 support. I'm happy to create a PR for this eventually, I have good expertise with CMake but am just short on time to work on it. I appreciate the work done to date on CMake in NetCDF, thank you.

@WardF WardF modified the milestones: 4.9.1, 4.9.2 Feb 13, 2023
@WardF WardF modified the milestones: 4.9.2, 4.9.3 May 16, 2023
mathstuf added a commit to mathstuf/netcdf-c that referenced this issue Sep 6, 2023
@mathstuf
Copy link
Contributor

mathstuf commented Sep 6, 2023

See #2751 for at least getting the HDF5 bit covered.

mathstuf added a commit to mathstuf/netcdf-c that referenced this issue Sep 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants