diff --git a/CMakeLists.txt b/CMakeLists.txt index 3657c8ade..0e9f22329 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -56,6 +56,7 @@ if(OPENMP) find_package(OpenMP REQUIRED COMPONENTS Fortran) endif() +# Find the NCEPLIBS packages we need. find_package(sfcio 1.4.0 REQUIRED) find_package(w3nco 2.4.0 REQUIRED) find_package(bacio 2.4.0 REQUIRED) @@ -67,6 +68,16 @@ find_package(g2 3.4.0 REQUIRED) find_package(wgrib2 2.0.8 REQUIRED) find_package(sigio 2.3.0 REQUIRED) +# The name of the bacio library changed with the 2.5.0 release. The +# "_4" was removed from the library and include directory name in the +# bacio-2.5.0 release. Set a name variable to be used in the rest of +# the cmake build. +if(bacio_VERSION GREATER_EQUAL 2.5.0) + set(bacio_name bacio) +else() + set(bacio_name bacio_4) +endif() + # EMC requires executables in ./exec set(exec_dir bin) if(EMC_EXEC_DIR) diff --git a/sorc/chgres_cube.fd/CMakeLists.txt b/sorc/chgres_cube.fd/CMakeLists.txt index 7b6ad9388..870e99b6a 100644 --- a/sorc/chgres_cube.fd/CMakeLists.txt +++ b/sorc/chgres_cube.fd/CMakeLists.txt @@ -45,7 +45,7 @@ target_link_libraries( nemsio::nemsio sfcio::sfcio sigio::sigio - bacio::bacio_4 + bacio::${bacio_name} sp::sp_d w3nco::w3nco_d esmf diff --git a/sorc/emcsfc_ice_blend.fd/CMakeLists.txt b/sorc/emcsfc_ice_blend.fd/CMakeLists.txt index 9373c4c9c..99f6ced52 100644 --- a/sorc/emcsfc_ice_blend.fd/CMakeLists.txt +++ b/sorc/emcsfc_ice_blend.fd/CMakeLists.txt @@ -10,7 +10,7 @@ set(exe_name emcsfc_ice_blend) add_executable(${exe_name} ${fortran_src}) target_link_libraries( ${exe_name} - bacio::bacio_4 + bacio::${bacio_name} g2::g2_4 w3nco::w3nco_4) diff --git a/sorc/emcsfc_snow2mdl.fd/CMakeLists.txt b/sorc/emcsfc_snow2mdl.fd/CMakeLists.txt index d43ca3c01..89a49c49b 100644 --- a/sorc/emcsfc_snow2mdl.fd/CMakeLists.txt +++ b/sorc/emcsfc_snow2mdl.fd/CMakeLists.txt @@ -32,7 +32,7 @@ target_link_libraries(snow2mdl_lib g2::g2_d ip::ip_d sp::sp_d - bacio::bacio_4 + bacio::${bacio_name} w3nco::w3nco_d) if(OpenMP_Fortran_FOUND) diff --git a/sorc/global_cycle.fd/CMakeLists.txt b/sorc/global_cycle.fd/CMakeLists.txt index c9e009f20..b5b1563d4 100644 --- a/sorc/global_cycle.fd/CMakeLists.txt +++ b/sorc/global_cycle.fd/CMakeLists.txt @@ -37,7 +37,7 @@ target_link_libraries( global_cycle_lib PUBLIC w3nco::w3nco_d - bacio::bacio_4 + bacio::${bacio_name} ip::ip_d sp::sp_d MPI::MPI_Fortran diff --git a/sorc/orog_mask_tools.fd/orog.fd/CMakeLists.txt b/sorc/orog_mask_tools.fd/orog.fd/CMakeLists.txt index e84d9cbee..a8a92af7a 100644 --- a/sorc/orog_mask_tools.fd/orog.fd/CMakeLists.txt +++ b/sorc/orog_mask_tools.fd/orog.fd/CMakeLists.txt @@ -1,3 +1,7 @@ +# This is the CMake file for the orog.fd directory in UFS_UTILS. +# +# Mark Potts, Kyle Gerheiser, Rahul Mahajan, Ed Hartnett + set(lib_src netcdf_io.F90) set(exe_src mtnlm7_oclsm.f) @@ -22,7 +26,7 @@ target_include_directories(orog_lib INTERFACE ${mod_dir}) target_link_libraries( orog_lib PUBLIC - bacio::bacio_4 + bacio::${bacio_name} w3nco::w3nco_d ip::ip_d sp::sp_d