Skip to content

Commit

Permalink
Fix linking order of netCDF libraries.
Browse files Browse the repository at this point in the history
The netCDF Fortran library depends on the netCDF library. For some
linkers (e.g., ld.bfd), the linking order matters.
Make sure to have the netCDF Fortran library *before* the netCDF library
in the linker flags.
  • Loading branch information
mmuetzel committed Oct 2, 2024
1 parent 4ba4ecb commit 3abb910
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cmake/Modules/FindNETCDF.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ IF (NETCDF_INCLUDE_DIR AND NETCDF_LIBRARY AND NETCDFF_LIBRARY)
UNSET(NETCDF_FAILMSG)
SET(NETCDFLIB_FOUND TRUE)
SET(NETCDF_INCLUDE_DIR ${NETCDF_INCLUDE_DIR})
SET(NETCDF_LIBRARIES "${NETCDF_LIBRARY};${NETCDFF_LIBRARY}")
SET(NETCDF_LIBRARIES "${NETCDFF_LIBRARY};${NETCDF_LIBRARY}")
ELSE()
SET(NETCDF_FAILMSG "NETCDF libraries not found.")
ENDIF()
Expand Down

0 comments on commit 3abb910

Please sign in to comment.