Open
Description
Pleas let me know if you can offer any advice on resolving the following problem:
I set up a small repository to learn how to use FindNetCDF. The repository has just two Fortran source files, only one of which depends on NetCDF as specified in a single use netcdf statement. An abbreviated transcript of my results using my repository's add-cmake-file branch follows:
$ git clone --recursive https://github.com/sourceryinstitute/learning-cmake-find.git
$ cd learning-cmake-find
$ git checkout add-cmake-file
$ mkdir build
$ cd build
$ FC=gfortran cmake ..
-- Found NetCDF: /opt/local/lib/libnetcdf.dylib
$ make
Scanning dependencies of target io_routines
[ 50%] Building Fortran object
CMakeFiles/io_routines.dir/src/io_routines.f90.o
/Users/rouson/Code/learning-make-find/src/io_routines.f90:18:8:
use netcdf
1
Fatal Error: Can't open module file ‘netcdf.mod’ for reading at (1): No
such file or directory
compilation terminated.
make[2]: *** [CMakeFiles/io_routines.dir/src/io_routines.f90.o] Error 1
make[1]: *** [CMakeFiles/io_routines.dir/all] Error 2
make: *** [all] Error 2
I used MacPorts on macOS Sierra to install netcdf and netcdf-fortran with the resulting installed files:
$ port contents netcdf
Port netcdf contains:
/opt/local/bin/nc-config
/opt/local/bin/nccopy
/opt/local/bin/ncdump
/opt/local/bin/ncgen
/opt/local/bin/ncgen3
/opt/local/include/netcdf.h
/opt/local/include/netcdf_mem.h
/opt/local/include/netcdf_meta.h
/opt/local/lib/cmake/netCDF/netCDFConfig.cmake
/opt/local/lib/cmake/netCDF/netCDFConfigVersion.cmake
/opt/local/lib/cmake/netCDF/netCDFTargets-release.cmake
/opt/local/lib/cmake/netCDF/netCDFTargets.cmake
/opt/local/lib/libnetcdf.11.3.0.dylib
/opt/local/lib/libnetcdf.11.dylib
/opt/local/lib/libnetcdf.dylib
/opt/local/lib/libnetcdf.settings
/opt/local/lib/pkgconfig/netcdf.pc
/opt/local/share/man/man1/nccopy.1.gz
/opt/local/share/man/man1/ncdump.1.gz
/opt/local/share/man/man1/ncgen.1.gz
/opt/local/share/man/man1/ncgen3.1.gz
/opt/local/share/man/man3/netcdf.3.gz
$ port contents netcdf-fortran
Port netcdf-fortran contains:
/opt/local/bin/nf-config
/opt/local/include/netcdf.inc
/opt/local/include/netcdf.mod
/opt/local/include/netcdf4_f03.mod
/opt/local/include/netcdf4_nc_interfaces.mod
/opt/local/include/netcdf4_nf_interfaces.mod
/opt/local/include/netcdf_f03.mod
/opt/local/include/netcdf_fortv2_c_interfaces.mod
/opt/local/include/netcdf_nc_data.mod
/opt/local/include/netcdf_nc_interfaces.mod
/opt/local/include/netcdf_nf_data.mod
/opt/local/include/netcdf_nf_interfaces.mod
/opt/local/include/typesizes.mod
/opt/local/lib/libnetcdff.6.dylib
/opt/local/lib/libnetcdff.a
/opt/local/lib/libnetcdff.dylib
/opt/local/lib/pkgconfig/netcdf-fortran.pc
/opt/local/share/man/man3/netcdf_fortran.3.gz
Metadata
Metadata
Assignees
Labels
No labels