Skip to content

Commit

Permalink
Kyle's updates for finding the wgrib2 library.
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgeGayno-NOAA committed Sep 8, 2021
1 parent 7e87be1 commit 47e3ea8
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
23 changes: 23 additions & 0 deletions cmake/Findwgrib2.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# This module produces the target wgrib2::wgrib2

find_path(WGRIB2_INCLUDES wgrib2api.mod)

find_library(WGRIB2_LIBRARIES libwgrib2.a)

find_program(WGRIB2_EXE wgrib2)
execute_process(COMMAND ${WGRIB2_EXE} --version OUTPUT_VARIABLE version_str)
string(SUBSTRING ${version_str} 3 5 version)

mark_as_advanced(WGRIB2_INCLUDES WGRIB2_LIBRARIES)

add_library(wgrib2::wgrib2 UNKNOWN IMPORTED)

set_target_properties(wgrib2::wgrib2 PROPERTIES
IMPORTED_LOCATION "${WGRIB2_LIBRARIES}"
INTERFACE_INCLUDE_DIRECTORIES "${WGRIB2_INCLUDES}"
INTERFACE_LINK_LIBRARIES "${WGRIB2_LIBRARIES}")

find_package_handle_standard_args(wgrib2
REQUIRED_VARS WGRIB2_LIBRARIES WGRIB2_INCLUDES WGRIB2_EXE
VERSION_VAR version
)
3 changes: 1 addition & 2 deletions sorc/chgres_cube.fd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ target_link_libraries(
sp::sp_d
w3nco::w3nco_d
esmf
wgrib2::wgrib2_lib
wgrib2::wgrib2_api
wgrib2::wgrib2
MPI::MPI_Fortran
NetCDF::NetCDF_Fortran)

Expand Down

0 comments on commit 47e3ea8

Please sign in to comment.