seacas icon indicating copy to clipboard operation
seacas copied to clipboard

CMake handling of NetCDF inconsistent with NetCDF naming scheme

Open zbeekman opened this issue 5 years ago • 4 comments

Installing NetCDF4 through CMake provides the following cmake packages/modules for importing targets:

lib/cmake/netCDF/netCDFConfig.cmake
lib/cmake/netCDF/netCDFConfigVersion.cmake
lib/cmake/netCDF/netCDFTargets-debug.cmake
lib/cmake/netCDF/netCDFTargets.cmake

However, the SEACAS-Exodus build system is looking for NetCDFConfig.cmake, not netCDFConfig.cmake. Can this be updated? How is it working for you? (Maybe case-insensitive file systems caused this to go unnoticed?)

zbeekman avatar Sep 13 '18 14:09 zbeekman

To be fair, it looks like NetCDF spells it that way in most of their documentation and online.... So maybe I should report this to them. But if they change it, any packages consuming NetCDF as it stands will now break. If they provide the lowercase dash version of the cmake packages this would be a non-issue

zbeekman avatar Sep 13 '18 14:09 zbeekman

SEACAS relies on the FindNetCDF in ../cmake/tribits/common_tpls/find_modules/FindNetCDF.cmake which sets some defines and dependencies that are relied on in other parts of the build. I'm not sure whether the SEACAS CMake build can work off of the NetCDF-provided files you list above.

gsjaardema avatar Sep 13 '18 19:09 gsjaardema

Yes, it looks like variable naming etc. is borked too. Using CMake package config files provided by the packages is usually much less of a world of Hurt than FindModules, since the application takes care of updates to library names, include files, compile/link flags, defines etc. and then the consuming package just links against the appropriate libraries and all of these details get transitively propagated.

I am just trying to build Exodus support on Windows, and using CMake External Projects (BTW, that would be more portable for Exodus/SEACAS too, IMO, rather than bash scripts for getting TPLs). I have built and "installed" static NetCDF into OUR TPL location in OUR build tree with ExternalProject_Add() and when I pass configure options to CMake, including the documented path to NetCDF, I get a complaint about missing NetCDFConfig.cmake or netcdf-config.cmake. This is presumably using the custom NetCDF find module from seacas, because I invoke CMake exactly how the script in the seacas-exodus.zip file does it.

Any pointers on resolving this?

Simply renaming the config files provided by my (latest stable release) of NetCDF to use the naming convention results in additional errors because, if it's not using modern CMake and transitive dependency propagation, then it is still exporting variables with names like NetCDF-libraries but seacas-exodus is looking for variables like netCDF-libraries, which are NOT provided by the cmake config files NetCDF installs.

Maybe I should just read through the find module and point the explicit variables for headers libs etc. to the NetCDF install location and pass those explicitly to CMake when configuring seacas-exodus?

zbeekman avatar Sep 14 '18 16:09 zbeekman

Stale issue message

github-actions[bot] avatar Nov 06 '20 01:11 github-actions[bot]