There may be an elegant solution, but for now we will just provide instructions alongside the error. When cmake invokes CHECK_LIBRARY_EXISTS() against a static library (such as libnetcdf.a), the dependencies must be specified manually, since there is no way to infer these dependencies with static libraries; this can be handled programmatically in the CMakeLists.txt file, where we check for nc-config and, if present, use the output of nc-config --libs, but for now we will just present this information when encountering this error.
The fix is to set LDFLAGS to the output from nc-config --libs.
There may be an elegant solution, but for now we will just provide instructions alongside the error. When cmake invokes
CHECK_LIBRARY_EXISTS()
against a static library (such aslibnetcdf.a
), the dependencies must be specified manually, since there is no way to infer these dependencies with static libraries; this can be handled programmatically in theCMakeLists.txt
file, where we check fornc-config
and, if present, use the output ofnc-config --libs
, but for now we will just present this information when encountering this error.The fix is to set
LDFLAGS
to the output fromnc-config --libs
.