FindNetCDF.cmake with imported targets
NetCDF4 is a powerful scientific data format based on HDF5 standard. NetCDF4 is directly usable by ParaView including the CF (Climate and Format) metadata convention. We have created a FindNetCDF.cmake that efficiently finds NetCDF libraries for use in CMake.
Example:
Place FindNetCDF.cmake file under project cmake/ then from CMakeLists.txt:
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
find_package(NetCDF COMPONENTS Fortran REQUIRED)
# example target
add_executable(main main.f90)
target_link_libraries(main PRIVATE NetCDF::NetCDF_Fortran)