diff --git a/CMakeLists.txt b/CMakeLists.txt index 24dea3c93..60a0cf105 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -104,8 +104,10 @@ find_package(w3emc 2.9.0 REQUIRED) find_package(bacio 2.4.0 REQUIRED) find_package(nemsio 2.5.0 REQUIRED) find_package(sigio 2.3.0 REQUIRED) -find_package(sp 2.3.3 REQUIRED) find_package(ip 3.3.3 REQUIRED) +if(ip_VERSION LESS 5.0) + find_package(sp 2.3.3 REQUIRED) +endif() find_package(g2 3.4.3 REQUIRED) find_package(sigio 2.3.0 REQUIRED) diff --git a/sorc/chgres_cube.fd/CMakeLists.txt b/sorc/chgres_cube.fd/CMakeLists.txt index 53fe3644d..3a1803569 100644 --- a/sorc/chgres_cube.fd/CMakeLists.txt +++ b/sorc/chgres_cube.fd/CMakeLists.txt @@ -49,13 +49,16 @@ target_link_libraries( sigio::sigio bacio::bacio_4 ip::ip_d - sp::sp_d w3emc::w3emc_d esmf msis2 MPI::MPI_Fortran NetCDF::NetCDF_Fortran) +if(sp_FOUND) + target_link_libraries(chgres_cube_lib PUBLIC sp::sp_d) +endif() + if(OpenMP_Fortran_FOUND) target_link_libraries(${exe_name} PUBLIC OpenMP::OpenMP_Fortran) endif() diff --git a/sorc/emcsfc_snow2mdl.fd/CMakeLists.txt b/sorc/emcsfc_snow2mdl.fd/CMakeLists.txt index 081fa6912..5dee5fa6a 100644 --- a/sorc/emcsfc_snow2mdl.fd/CMakeLists.txt +++ b/sorc/emcsfc_snow2mdl.fd/CMakeLists.txt @@ -34,10 +34,13 @@ target_link_libraries(snow2mdl_lib PUBLIC g2::g2_d ip::ip_d - sp::sp_d bacio::bacio_4 w3emc::w3emc_d) +if(sp_FOUND) + target_link_libraries(global_cycle_lib PUBLIC sp::sp_d) +endif() + if(OpenMP_Fortran_FOUND) target_link_libraries(${exe_name} PUBLIC OpenMP::OpenMP_Fortran) endif() diff --git a/sorc/global_cycle.fd/CMakeLists.txt b/sorc/global_cycle.fd/CMakeLists.txt index 0f73d4ab6..7adfae13f 100644 --- a/sorc/global_cycle.fd/CMakeLists.txt +++ b/sorc/global_cycle.fd/CMakeLists.txt @@ -39,11 +39,14 @@ target_link_libraries( w3emc::w3emc_d bacio::bacio_4 ip::ip_d - sp::sp_d MPI::MPI_Fortran NetCDF::NetCDF_Fortran noah_lsm_routines) +if(sp_FOUND) + target_link_libraries(global_cycle_lib PUBLIC sp::sp_d) +endif() + if(OpenMP_Fortran_FOUND) target_link_libraries(global_cycle_lib PUBLIC OpenMP::OpenMP_Fortran) endif() diff --git a/sorc/orog_mask_tools.fd/orog.fd/CMakeLists.txt b/sorc/orog_mask_tools.fd/orog.fd/CMakeLists.txt index 04ab86742..6fbed0573 100644 --- a/sorc/orog_mask_tools.fd/orog.fd/CMakeLists.txt +++ b/sorc/orog_mask_tools.fd/orog.fd/CMakeLists.txt @@ -28,9 +28,12 @@ target_link_libraries( bacio::bacio_4 w3emc::w3emc_d ip::ip_d - sp::sp_d NetCDF::NetCDF_Fortran) +if(sp_FOUND) + target_link_libraries(orog_lib PUBLIC sp::sp_d) +endif() + if(OpenMP_Fortran_FOUND) target_link_libraries(orog_lib PUBLIC OpenMP::OpenMP_Fortran) endif() diff --git a/sorc/weight_gen.fd/CMakeLists.txt b/sorc/weight_gen.fd/CMakeLists.txt index 6871c37cc..0aee376b1 100644 --- a/sorc/weight_gen.fd/CMakeLists.txt +++ b/sorc/weight_gen.fd/CMakeLists.txt @@ -12,9 +12,12 @@ set(exe_name weight_gen) add_executable(${exe_name} ${fortran_src}) target_link_libraries( ${exe_name} - sp::sp_d NetCDF::NetCDF_Fortran) +if(sp_FOUND) + target_link_libraries(${exe_name} PUBLIC sp::sp_d) +endif() + install(TARGETS ${exe_name}) # If doxygen documentation we enabled, build it.