Skip to content

Commit

Permalink
Fixes frontier netcdf handling
Browse files Browse the repository at this point in the history
  • Loading branch information
jgfouca committed Oct 4, 2023
1 parent 50b3694 commit 653b97b
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions components/cmake/modules/FindNETCDF.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,26 @@ function(get_netcdf_libs ncpath nfpath)
# Get C libs
if (EXISTS ${ncconfig})
execute_process(COMMAND ${ncconfig} --libs OUTPUT_VARIABLE nclibs OUTPUT_STRIP_TRAILING_WHITESPACE)
else()
find_library(nclibs netcdf REQUIRED PATHS ${ncpath}/lib ${ncpath}/lib64)
endif()

# Fall back to find_library
if (NOT nclibs)
find_library(nclibs_temp netcdf REQUIRED PATHS ${ncpath}/lib ${ncpath}/lib64)
set(nclibs ${nclibs_temp})
endif()

# Get fortran libs
if (EXISTS ${nfconfig})
execute_process(COMMAND ${nfconfig} --flibs OUTPUT_VARIABLE nflibs OUTPUT_STRIP_TRAILING_WHITESPACE)
else()
find_library(nflibs netcdff REQUIRED PATHS ${nfpath}/lib ${nfpath}/lib64)
endif()

if (NOT nflibs)
find_library(nflibs_temp netcdff REQUIRED PATHS ${nfpath}/lib ${nfpath}/lib64)
set(nflibs ${nflibs_temp})
endif()

# C libs need to come last
set(GET_NETCDF_LIBS_RESULT "${nflibs} ${nclibs}" PARENT_SCOPE)
set(GET_NETCDF_LIBS_RESULT ${nflibs} ${nclibs} PARENT_SCOPE)
endfunction()

function(create_netcdf_target)
Expand Down

0 comments on commit 653b97b

Please sign in to comment.