Unidata / netcdf-c

Official GitHub repository for netCDF-C libraries and utilities.
BSD 3-Clause "New" or "Revised" License
514 stars 262 forks source link

nc-config references libraries which do not exist #3039

Open kevinushey opened 2 weeks ago

kevinushey commented 2 weeks ago

I tried building netcdf with:

cmake -B build -S .
cd build
cmake --build .

This produces a nc-config file that has:

libsprivate="-lHDF5::HDF5 -lhdf5::hdf5_hl -lm -lz -lzip -lzstd -lbz2 -lsz -lCURL::libcurl -lxml2"

I suspect those library paths, e.g. -lHDF5::HDF5, are just the raw CMake directives. Do those need to be expanded into "real" library paths before generating nc-config?

kevinushey commented 2 weeks ago

I guess the presence of https://github.com/Unidata/netcdf-c/blob/95a6361cc617b9a8a96e4473753110bc0a816b99/nc-config.cmake.in#L361-L374 mean this is intentional, and I should instead be using --libs-ac-syntax? But then you get:

$ ./nc-config --static --libs-ac-syntax
-L/usr/local/lib -lnetcdf -lHDF5::HDF5 -lhdf5::hdf5_hl -lm -lz -lzip -lzstd -lbz2 -lsz -lCURL::libcurl -lxml2
-L/usr/local/lib -lnetcdf -lhdf5 -lhdf5_hl -lm -lz -lzip -lzstd -lbz2 -lsz -lCURL::libcurl -lxml2

Two lines are logged, and CURL::libcurl remains unreplaced in the second output.