--- a/CMakeLists.txt	2019-09-13 04:34:58.000000000 +1000
+++ b/CMakeLists.txt	2020-07-19 11:10:36.548976300 +1000
@@ -349,10 +349,10 @@
 ###
 # Find NetCDF
 ###
-IF(NOT netCDF_LIBRARIES AND NOT netCDF_INCLUDE_DIR)
+IF(NOT NETCDF_LIB_NAME AND NOT netCDF_LIBRARIES AND NOT netCDF_INCLUDE_DIR)
   FIND_PACKAGE(netCDF QUIET)
 ELSE()
-  SET(netCDF_FOUND TRUE)
+  SET(NETCDF_LIB_NAME CACHE STRING "netcdf libnetcdf")
 ENDIF()
 
 IF (netCDF_FOUND)
@@ -361,7 +361,7 @@
   SET(NETCDF_C_INCLUDE_DIR ${netCDF_INCLUDE_DIR})
 ELSE()
   # netCDF not properly packaged. Try to find it manually.
-  FIND_LIBRARY(NETCDF_C_LIBRARY NAMES netcdf libnetcdf)
+  FIND_LIBRARY(NETCDF_C_LIBRARY NAMES ${NETCDF_LIB_NAME})
   IF(NOT NETCDF_C_LIBRARY)
     MESSAGE(FATAL_ERROR "libnetcdf not found. Please reinstall and try again.")
   ELSE()
@@ -395,12 +395,20 @@
 ###
 # Find HDF5
 ###
+SET(HDF5_LIB_NAME ${HDF5_LIB_NAME} CACHE STRING "")
+IF(HDF5_LIB_NAME)
+  FIND_LIBRARY(HDF5_C_LIBRARY_hdf5 NAMES ${HDF5_LIB_NAME})
+  IF(HDF5_C_LIBRARY_hdf5)
+    MESSAGE(STATUS "Found hdf5: ${HDF5_C_LIBRARY_hdf5}")
+  ENDIF()
+ELSE(HDF5_LIB_NAME)
 IF(MSVC)
   SET(SEARCH_PACKAGE_NAME ${HDF5_PACKAGE_NAME})
   FIND_PACKAGE(HDF5 NAMES ${SEARCH_PACKAGE_NAME} COMPONENTS C HL NO_MODULES REQUIRED ${NC_HDF5_LINK_TYPE})
 ELSE(MSVC)
   FIND_PACKAGE(HDF5 COMPONENTS C HL REQUIRED)
 ENDIF(MSVC)
+ENDIF(HDF5_LIB_NAME)
 
 CHECK_LIBRARY_EXISTS(${HDF5_C_LIBRARY_hdf5} H5free_memory "" HAVE_H5FREE_MEMORY)
 IF(NOT HAVE_H5FREE_MEMORY)
