BOUT-dev
BOUT-dev copied to clipboard
NetCDF in CMake build instructions
In the docs,
https://bout-dev.readthedocs.io/en/latest/user_docs/installing.html#common-cmake-options
it is suggested to use NetCDF_ROOT to pass the location of the NetCDF install.
- Does the capitalisation matter?
netCDF_ROOTis used inFindnetCDF.cmake, e.g. https://github.com/boutproject/BOUT-dev/blob/4acdfdcb42dd0d8abfde06b5c2544c80d0bf0622/cmake/FindnetCDF.cmake#L46 - For me,
NetCDF_ROOT(ornetCDF_ROOT) does not appear inccmake(even when including 'advanced options'), or in the output ofcmake . -B build -LH. Is that because CMake already foundnc-config? ShouldnetCDF_ROOTappear inccmake? - While helping someone try to link to a source-build of NetCDF, it looks like even when using CMake to build NetCDF, it is necessary to 'install' the library (see https://docs.unidata.ucar.edu/netcdf-c/current/netCDF-CMake.html) - I found that surprising... Maybe it would be worth updating https://bout-dev.readthedocs.io/en/latest/user_docs/advanced_install.html#installing-netcdf-from-source to mention a CMake build of NetCDF?
Sorry @johnomotani, I missed this at the time.
- Good spot, it should be
netCDF_ROOT. I don't particularly like this weird mix, but that's how the netCDF team style it, and what they use in their CMake files. - Hmm, the
_ROOTvariables are a little bit confusing. My understanding is that you can set<package>_ROOTto control wherefind_packagelooks, but it seems none of them in appear incmake -LH-- but there's usually a<package>_DIRvariable which should be the actual found location. - Urgh, yes good point. I fixed netcdf-cxx4 to work from just the build directory, but it seems the main C library still doesn't work like that and does need to be installed