Skip to content

Problems with FindNetCDF.cmake finding both C and Fortran #59

@edwardhartnett

Description

@edwardhartnett

I am trying to build FMS like this:

cmake -DCMAKE_PREFIX_PATH="/usr/local/FMS-2021.03.01;/usr/local/netcdf-c-4.8.1_hdf5-1.12.1_zlib-ng_szip_mpich;/usr/local/netcdf-c-4.7.4_hdf4-1.10.7_mpich;/usr/local/netcdf-fortran-4.5.3_mpich;/usr/local/NCEPLIBS-w3emc-2.7.3;/usr/local/NCEPLIBS-w3nco-2.4.1;/usr/local/NCEPLIBS-bacio-2.4.1;NCEPLIBS-nemsio-2.5.1;/usr/local/NCEPLIBS-sp-2.3.3;/usr/local/esmf-8.0.1;/usr/local/NCEPLIBS-nemsio-2.5.1;/usr/local/NCEPLIBS-sigio-2.3.2" -DCMAKE_Fortran_FLAGS="-fno-range-check -fdefault-real-8 -cpp -ffree-line-length-none" ..
-- The C compiler identification is GNU 11.2.0
-- The Fortran compiler identification is GNU 11.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Check for working Fortran compiler: /usr/bin/gfortran - skipped
CMake Error at cmake/FindNetCDF.cmake:225 (message):
  Unable to properly find NetCDF.  Found static libraries at:
  /home/ed/fv3atm/NetCDF_Fortran_LIBRARY-NOTFOUND but could not run
  nc-config:
Call Stack (most recent call first):
  CMakeLists.txt:15 (find_package)


CMake Error at /snap/cmake/992/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find NetCDF (missing: Fortran) (found suitable version "4.7.4",
  minimum required is "4.3.3")
Call Stack (most recent call first):
  /snap/cmake/992/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
  cmake/FindNetCDF.cmake:291 (find_package_handle_standard_args)
  CMakeLists.txt:15 (find_package)


-- Configuring incomplete, errors occurred!
See also "/home/ed/fv3atm/b/CMakeFiles/CMakeOutput.log".
(base) ed@mikado:~/fv3atm/b$ 

@kgerheiser can FindNetCDF.cmake deal with the netCDF C and Fortran libraries installed in different directories?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions