Skip to content

Commit c7bb068

Browse files
committed
Fix bug from netCDF fortran not providing the correct lib location, this is fixed in Unidata/netcdf-fortran#434 (b84141a)
1 parent 1f1b93d commit c7bb068

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

cmake/modules/FindnetCDF-Fortran.cmake

+6-2
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,6 @@ else()
6868
f03
6969
)
7070

71-
set( netCDF-Fortran_DEFINITIONS )
72-
set( netCDF-Fortran_LIBRARY_DIR ${netCDF-Fortran_PREFIX}/lib )
7371
foreach( NF_QUERY ${netCDF-Fortran_QUERY_YES_OPTIONS} )
7472
execute_process( COMMAND ${NETCDF-FORTRAN_PROGRAM} --has-${NF_QUERY} OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE netCDF-Fortran_${NF_QUERY}_LOWERCASE )
7573
string( TOUPPER ${NF_QUERY} NF_QUERY_UPPERCASE )
@@ -78,6 +76,12 @@ else()
7876
set( netCDF-Fortran_HAS_${NF_QUERY_UPPERCASE} ${NF_ANSWER_UPPERCASE} )
7977
endforeach()
8078

79+
80+
# A bug in previous netcdf-fortran cmake builds, extract from flibs
81+
string( REGEX MATCH "^-L([^ ]*)" netCDF-Fortran_LIBRARY_LINK_LOCATION ${netCDF-Fortran_FLIBS} )
82+
set( netCDF-Fortran_LIBRARY_DIR ${CMAKE_MATCH_1} )
83+
84+
set( netCDF-Fortran_DEFINITIONS )
8185
set( netCDF-Fortran_LIBRARIES
8286
$<$<LINK_LANGUAGE:Fortran>:${netCDF-Fortran_FLIBS}>
8387
)

0 commit comments

Comments
 (0)