From 5fc26fff104e5106bd11f08b708d39c8ddf8218d Mon Sep 17 00:00:00 2001 From: Micael Oliveira Date: Wed, 29 Nov 2023 10:42:56 +1100 Subject: [PATCH 1/5] Bug fix: one ww3 utility was not installed. --- WW3/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WW3/CMakeLists.txt b/WW3/CMakeLists.txt index bb225c0..ff4dff3 100644 --- a/WW3/CMakeLists.txt +++ b/WW3/CMakeLists.txt @@ -142,6 +142,6 @@ target_link_libraries(OM3_ww3_ounp PRIVATE OM3_ww3) ## Installs if(OM3_BIN_INSTALL) - install(TARGETS OM3_ww3_grid OM3_ww3_strt OM3_ww3_ounf OM3_ww3_ounp + install(TARGETS OM3_ww3_grid OM3_ww3_strt OM3_ww3_outf OM3_ww3_ounf OM3_ww3_ounp RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) endif() From 786f704e145d648ddc852a9d993d43c4d37d303e Mon Sep 17 00:00:00 2001 From: Micael Oliveira Date: Wed, 29 Nov 2023 13:58:23 +1100 Subject: [PATCH 2/5] Bug fix: the CMake variables that control which components are built were incorrectly set, which resulted in all components being build all the time. Now also print the components to build during configuration. --- CMakeLists.txt | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4c7533e..6b02c47 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -63,20 +63,24 @@ include(AddPatchedSource) # Do not build components that are not going to be used if(OM3_ENABLE_MOM6 OR OM3_ENABLE_MOM6-CICE6 OR OM3_ENABLE_MOM6-WW3 OR OM3_ENABLE_MOM6-CICE6-WW3) - set(OM3_MOM6 ON FORCE) + set(OM3_BUILD_MOM6 ON) else() - set(OM3_MOM6 OFF FORCE) + set(OM3_BUILD_MOM6 OFF) endif() if(OM3_ENABLE_CICE6 OR OM3_ENABLE_MOM6-CICE6 OR OM3_ENABLE_CICE6-WW3 OR OM3_ENABLE_MOM6-CICE6-WW3) - set(OM3_CICE6 ON FORCE) + set(OM3_BUILD_CICE6 ON) else() - set(OM3_CICE6 OFF FORCE) + set(OM3_BUILD_CICE6 OFF) endif() if(OM3_ENABLE_WW3 OR OM3_ENABLE_MOM6-WW3 OR OM3_ENABLE_CICE6-WW3 OR OM3_ENABLE_MOM6-CICE6-WW3) - set(OM3_WW3 ON FORCE) + set(OM3_BUILD_WW3 ON) else() - set(OM3_WW3 OFF FORCE) + set(OM3_BUILD_WW3 OFF) endif() +message(STATUS "Components to build") +message(STATUS " - OM3_BUILD_MOM6 ${OM3_BUILD_MOM6}") +message(STATUS " - OM3_BUILD_CICE6 ${OM3_BUILD_CICE6}") +message(STATUS " - OM3_BUILD_WW3 ${OM3_BUILD_WW3}") # Common compiler flags and definitions if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU") @@ -138,17 +142,17 @@ add_subdirectory(share) add_subdirectory(CDEPS) # Ocean component (MOM6) -if(OM3_MOM6) +if(OM3_BUILD_MOM6) add_subdirectory(MOM6) endif() # Sea-ice component (CICE6) -if(OM3_CICE6) +if(OM3_BUILD_CICE6) add_subdirectory(CICE) endif() # Wave component (WW3) -if(OM3_WW3) +if(OM3_BUILD_WW3) add_subdirectory(WW3) endif() From 57304cb22f914a4e75a8a74504b8d8d97484f611 Mon Sep 17 00:00:00 2001 From: Micael Oliveira Date: Tue, 24 Oct 2023 10:28:29 +1100 Subject: [PATCH 3/5] Split CMEPS library into CMEPS proper and the NUOPC cap share stuff. Cleanup the target link libraries declarations to only include the ones that are really necessary. --- CDEPS/CMakeLists.txt | 12 ++++++------ CICE/CMakeLists.txt | 2 +- CMEPS/CMakeLists.txt | 12 ++++++++++-- CMakeLists.txt | 4 +++- MOM6/CMakeLists.txt | 2 +- WW3/CMakeLists.txt | 1 - 6 files changed, 21 insertions(+), 12 deletions(-) diff --git a/CDEPS/CMakeLists.txt b/CDEPS/CMakeLists.txt index 3d39fb0..4ddf37b 100644 --- a/CDEPS/CMakeLists.txt +++ b/CDEPS/CMakeLists.txt @@ -5,7 +5,7 @@ add_fortran_library(OM3_cdeps_common mod/common STATIC) target_include_directories(OM3_cdeps_common PRIVATE $) target_link_libraries(OM3_cdeps_common PUBLIC esmf - PRIVATE OM3_share OM3_cmeps FoX::FoX PIO::PIO_Fortran + PRIVATE OM3_share OM3_cmeps OM3_nuopc_cap_share FoX::FoX PIO::PIO_Fortran ) target_sources(OM3_cdeps_common PRIVATE CDEPS/streams/dshr_methods_mod.F90 @@ -23,7 +23,7 @@ add_fortran_library(OM3_cdeps_datm mod/datm STATIC) target_include_directories(OM3_cdeps_datm PRIVATE $) target_link_libraries(OM3_cdeps_datm PUBLIC esmf - PRIVATE OM3_share OM3_cmeps FoX::FoX OM3_cdeps_common PIO::PIO_Fortran + PRIVATE OM3_cdeps_common OM3_share ) target_sources(OM3_cdeps_datm PRIVATE CDEPS/datm/datm_datamode_cfsr_mod.F90 @@ -42,7 +42,7 @@ add_fortran_library(OM3_cdeps_docn mod/docn STATIC) target_include_directories(OM3_cdeps_docn PRIVATE $) target_link_libraries(OM3_cdeps_docn PUBLIC esmf - PRIVATE OM3_share OM3_cmeps FoX::FoX OM3_cdeps_common PIO::PIO_Fortran + PRIVATE OM3_cdeps_common OM3_share ) target_sources(OM3_cdeps_docn PRIVATE CDEPS/docn/docn_datamode_aquaplanet_mod.F90 @@ -59,7 +59,7 @@ add_fortran_library(OM3_cdeps_dice mod/dice STATIC) target_include_directories(OM3_cdeps_dice PRIVATE $) target_link_libraries(OM3_cdeps_dice PUBLIC esmf - PRIVATE OM3_share OM3_cmeps FoX::FoX OM3_cdeps_common PIO::PIO_Fortran + PRIVATE OM3_cdeps_common OM3_share ) target_sources(OM3_cdeps_dice PRIVATE CDEPS/dice/dice_datamode_ssmi_mod.F90 @@ -72,7 +72,7 @@ add_fortran_library(OM3_cdeps_dwav mod/dwav STATIC) target_include_directories(OM3_cdeps_dwav PRIVATE $) target_link_libraries(OM3_cdeps_dwav PUBLIC esmf - PRIVATE OM3_share OM3_cmeps FoX::FoX OM3_cdeps_common PIO::PIO_Fortran + PRIVATE OM3_cdeps_common OM3_share ) target_sources(OM3_cdeps_dwav PRIVATE CDEPS/dwav/wav_comp_nuopc.F90 @@ -83,7 +83,7 @@ add_fortran_library(OM3_cdeps_drof mod/drof STATIC) target_include_directories(OM3_cdeps_drof PRIVATE $) target_link_libraries(OM3_cdeps_drof PUBLIC esmf - PRIVATE OM3_share OM3_cmeps FoX::FoX OM3_cdeps_common PIO::PIO_Fortran + PRIVATE OM3_cdeps_common OM3_share ) target_sources(OM3_cdeps_drof PRIVATE CDEPS/drof/rof_comp_nuopc.F90 diff --git a/CICE/CMakeLists.txt b/CICE/CMakeLists.txt index 9163186..a19a8c3 100644 --- a/CICE/CMakeLists.txt +++ b/CICE/CMakeLists.txt @@ -8,7 +8,7 @@ if(OM3_CICE_IO MATCHES "^(NetCDF|PIO)$") endif() target_link_libraries(OM3_cice PUBLIC esmf - PRIVATE OM3_share OM3_timing OM3_cdeps_common OM3_cmeps + PRIVATE OM3_cdeps_common OM3_nuopc_cap_share OM3_share OM3_timing ) if(OM3_CICE_IO MATCHES "^(NetCDF|PIO)$") target_link_libraries(OM3_cice PRIVATE NetCDF::NetCDF_Fortran) diff --git a/CMEPS/CMakeLists.txt b/CMEPS/CMakeLists.txt index ff6f610..85935a6 100644 --- a/CMEPS/CMakeLists.txt +++ b/CMEPS/CMakeLists.txt @@ -1,10 +1,10 @@ ### Targets ## CMEPS library -add_fortran_library(OM3_cmeps mod STATIC) +add_fortran_library(OM3_cmeps mod/cmeps STATIC) target_link_libraries(OM3_cmeps PUBLIC esmf - PRIVATE OM3_share OM3_timing PIO::PIO_Fortran + PRIVATE OM3_nuopc_cap_share OM3_share OM3_timing ) if(OpenMP_Fortran_FOUND) target_link_libraries(OM3_cmeps PRIVATE OpenMP::OpenMP_Fortran) @@ -46,7 +46,15 @@ target_sources(OM3_cmeps PRIVATE CMEPS/mediator/med_phases_post_glc_mod.F90 CMEPS/mediator/med_phases_post_rof_mod.F90 CMEPS/mediator/med_phases_post_wav_mod.F90 +) +## NUOPC cap share +add_fortran_library(OM3_nuopc_cap_share mod/nuopc_cap_share STATIC) +target_link_libraries(OM3_nuopc_cap_share + PUBLIC esmf + PRIVATE OM3_share +) +target_sources(OM3_nuopc_cap_share PRIVATE CMEPS/cesm/nuopc_cap_share/driver_pio_mod.F90 CMEPS/cesm/nuopc_cap_share/esm_utils_mod.F90 CMEPS/cesm/nuopc_cap_share/glc_elevclass_mod.F90 diff --git a/CMakeLists.txt b/CMakeLists.txt index 6b02c47..649f741 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,6 +36,7 @@ message(STATUS " - MOM6-CICE6-WW3 ${OM3_ENABLE_MOM6-CICE6-WW3}") # Build options option(OM3_BIN_INSTALL "Instal ACCESS-OM3 executables" ${PROJECT_IS_TOP_LEVEL}) +option(OM3_LIB_INSTALL "Instal ACCESS-OM3 libraries" OFF) option(OM3_OPENMP "Enable OpenMP threading" OFF) option(OM3_MOM_SYMMETRIC "Use symmetric memory" OFF) set(OM3_CICE_IO "PIO" CACHE STRING "CICE OPTIONS: Choose IO options.") @@ -43,6 +44,7 @@ set_property(CACHE OM3_CICE_IO PROPERTY STRINGS "NetCDF" "PIO" "Binary") message(STATUS "Build options") message(STATUS " - OM3_BIN_INSTALL ${OM3_BIN_INSTALL}") +message(STATUS " - OM3_LIB_INSTALL ${OM3_LIB_INSTALL}") message(STATUS " - OM3_OPENMP ${OM3_OPENMP}") message(STATUS " - OM3_MOM_SYMMETRIC ${OM3_MOM_SYMMETRIC}") message(STATUS " - OM3_CICE_IO ${OM3_CICE_IO}") @@ -190,7 +192,7 @@ foreach(CONF IN LISTS KnownConfigurations) ) target_link_libraries(OM3_cesm_driver_${CONF} PUBLIC esmf - PRIVATE OM3_share OM3_timing ${ComponentsTargets} OM3_cmeps OM3_cdeps_common OM3_cdeps_drof OM3_cdeps_datm PIO::PIO_Fortran + PRIVATE ${ComponentsTargets} OM3_cdeps_drof OM3_cdeps_datm OM3_cmeps OM3_nuopc_cap_share OM3_share OM3_timing ) target_compile_definitions(OM3_cesm_driver_${CONF} PRIVATE MED_PRESENT ATM_PRESENT diff --git a/MOM6/CMakeLists.txt b/MOM6/CMakeLists.txt index f0619f0..4f7fda8 100644 --- a/MOM6/CMakeLists.txt +++ b/MOM6/CMakeLists.txt @@ -20,7 +20,7 @@ endif() target_compile_options(OM3_mom6 PRIVATE "$<$:${fortran_compile_flags}>") target_link_libraries(OM3_mom6 PUBLIC esmf - PRIVATE OM3_share OM3_cmeps FMS::fms_r8 NetCDF::NetCDF_Fortran + PRIVATE OM3_nuopc_cap_share OM3_share FMS::fms_r8 ) target_sources(OM3_mom6 PRIVATE MOM6/src/ALE/coord_adapt.F90 diff --git a/WW3/CMakeLists.txt b/WW3/CMakeLists.txt index ff4dff3..28417ff 100644 --- a/WW3/CMakeLists.txt +++ b/WW3/CMakeLists.txt @@ -20,7 +20,6 @@ set_property(SOURCE WW3/model/src/w3initmd.F90 ) target_link_libraries(OM3_ww3 PUBLIC esmf - PRIVATE NetCDF::NetCDF_Fortran ) # Process switches and get list of extra source files include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/check_switches.cmake) From c58a92bb8e37bed391f30c25c33cf2a2bc56920a Mon Sep 17 00:00:00 2001 From: Micael Oliveira Date: Tue, 24 Oct 2023 13:44:32 +1100 Subject: [PATCH 4/5] Change directory to store the Fortran modules of the driver libraries to be consistent with other targets. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 649f741..d7a28a3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -185,7 +185,7 @@ foreach(CONF IN LISTS KnownConfigurations) endif() # We use the CESM driver from CMEPS - add_fortran_library(OM3_cesm_driver_${CONF} OM3_cesm_driver_${CONF}/mod STATIC + add_fortran_library(OM3_cesm_driver_${CONF} mod/OM3_cesm_driver_${CONF} STATIC CMEPS/CMEPS/cesm/driver/esm.F90 CMEPS/CMEPS/cesm/driver/ensemble_driver.F90 CMEPS/CMEPS/cesm/driver/esm_time_mod.F90 From 6ce2fa65fd072df8e465b2fdef91369efc341501 Mon Sep 17 00:00:00 2001 From: Micael Oliveira Date: Wed, 29 Nov 2023 12:06:21 +1100 Subject: [PATCH 5/5] Define and use aliases for all libraries, as this seems to be considered good practice. --- CDEPS/CMakeLists.txt | 18 ++++++++++++------ CICE/CMakeLists.txt | 3 ++- CMEPS/CMakeLists.txt | 6 ++++-- CMakeLists.txt | 16 ++++++++-------- MOM6/CMakeLists.txt | 3 ++- WW3/CMakeLists.txt | 11 ++++++----- share/CMakeLists.txt | 4 +++- 7 files changed, 37 insertions(+), 24 deletions(-) diff --git a/CDEPS/CMakeLists.txt b/CDEPS/CMakeLists.txt index 4ddf37b..e32109d 100644 --- a/CDEPS/CMakeLists.txt +++ b/CDEPS/CMakeLists.txt @@ -2,10 +2,11 @@ ## Common library add_fortran_library(OM3_cdeps_common mod/common STATIC) +add_library(AccessOM3::cdeps_common ALIAS OM3_cdeps_common) target_include_directories(OM3_cdeps_common PRIVATE $) target_link_libraries(OM3_cdeps_common PUBLIC esmf - PRIVATE OM3_share OM3_cmeps OM3_nuopc_cap_share FoX::FoX PIO::PIO_Fortran + PRIVATE AccessOM3::share AccessOM3::cmeps AccessOM3::nuopc_cap_share FoX::FoX PIO::PIO_Fortran ) target_sources(OM3_cdeps_common PRIVATE CDEPS/streams/dshr_methods_mod.F90 @@ -20,10 +21,11 @@ target_sources(OM3_cdeps_common PRIVATE ## DATM add_fortran_library(OM3_cdeps_datm mod/datm STATIC) +add_library(AccessOM3::cdeps_datm ALIAS OM3_cdeps_datm) target_include_directories(OM3_cdeps_datm PRIVATE $) target_link_libraries(OM3_cdeps_datm PUBLIC esmf - PRIVATE OM3_cdeps_common OM3_share + PRIVATE AccessOM3::cdeps_common AccessOM3::share ) target_sources(OM3_cdeps_datm PRIVATE CDEPS/datm/datm_datamode_cfsr_mod.F90 @@ -39,10 +41,11 @@ add_patched_source(OM3_cdeps_datm CDEPS/datm/atm_comp_nuopc.F90) ## DOCN add_fortran_library(OM3_cdeps_docn mod/docn STATIC) +add_library(AccessOM3::cdeps_docn ALIAS OM3_cdeps_docn) target_include_directories(OM3_cdeps_docn PRIVATE $) target_link_libraries(OM3_cdeps_docn PUBLIC esmf - PRIVATE OM3_cdeps_common OM3_share + PRIVATE AccessOM3::cdeps_common AccessOM3::share ) target_sources(OM3_cdeps_docn PRIVATE CDEPS/docn/docn_datamode_aquaplanet_mod.F90 @@ -56,10 +59,11 @@ target_sources(OM3_cdeps_docn PRIVATE ## DICE add_fortran_library(OM3_cdeps_dice mod/dice STATIC) +add_library(AccessOM3::cdeps_dice ALIAS OM3_cdeps_dice) target_include_directories(OM3_cdeps_dice PRIVATE $) target_link_libraries(OM3_cdeps_dice PUBLIC esmf - PRIVATE OM3_cdeps_common OM3_share + PRIVATE AccessOM3::cdeps_common AccessOM3::share ) target_sources(OM3_cdeps_dice PRIVATE CDEPS/dice/dice_datamode_ssmi_mod.F90 @@ -69,10 +73,11 @@ target_sources(OM3_cdeps_dice PRIVATE ## DWAV add_fortran_library(OM3_cdeps_dwav mod/dwav STATIC) +add_library(AccessOM3::cdeps_dwav ALIAS OM3_cdeps_dwav) target_include_directories(OM3_cdeps_dwav PRIVATE $) target_link_libraries(OM3_cdeps_dwav PUBLIC esmf - PRIVATE OM3_cdeps_common OM3_share + PRIVATE AccessOM3::cdeps_common AccessOM3::share ) target_sources(OM3_cdeps_dwav PRIVATE CDEPS/dwav/wav_comp_nuopc.F90 @@ -80,10 +85,11 @@ target_sources(OM3_cdeps_dwav PRIVATE ## DROF add_fortran_library(OM3_cdeps_drof mod/drof STATIC) +add_library(AccessOM3::cdeps_drof ALIAS OM3_cdeps_drof) target_include_directories(OM3_cdeps_drof PRIVATE $) target_link_libraries(OM3_cdeps_drof PUBLIC esmf - PRIVATE OM3_cdeps_common OM3_share + PRIVATE AccessOM3::cdeps_common AccessOM3::share ) target_sources(OM3_cdeps_drof PRIVATE CDEPS/drof/rof_comp_nuopc.F90 diff --git a/CICE/CMakeLists.txt b/CICE/CMakeLists.txt index a19a8c3..f2afe79 100644 --- a/CICE/CMakeLists.txt +++ b/CICE/CMakeLists.txt @@ -2,13 +2,14 @@ ## CICE library add_fortran_library(OM3_cice mod STATIC) +add_library(AccessOM3::cice ALIAS OM3_cice) target_compile_definitions(OM3_cice PRIVATE FORTRANUNDERSCORE ncdf) if(OM3_CICE_IO MATCHES "^(NetCDF|PIO)$") target_compile_definitions(OM3_cice PRIVATE USE_NETCDF) endif() target_link_libraries(OM3_cice PUBLIC esmf - PRIVATE OM3_cdeps_common OM3_nuopc_cap_share OM3_share OM3_timing + PRIVATE AccessOM3::cdeps_common AccessOM3::nuopc_cap_share AccessOM3::share AccessOM3::timing ) if(OM3_CICE_IO MATCHES "^(NetCDF|PIO)$") target_link_libraries(OM3_cice PRIVATE NetCDF::NetCDF_Fortran) diff --git a/CMEPS/CMakeLists.txt b/CMEPS/CMakeLists.txt index 85935a6..54f255c 100644 --- a/CMEPS/CMakeLists.txt +++ b/CMEPS/CMakeLists.txt @@ -2,9 +2,10 @@ ## CMEPS library add_fortran_library(OM3_cmeps mod/cmeps STATIC) +add_library(AccessOM3::cmeps ALIAS OM3_cmeps) target_link_libraries(OM3_cmeps PUBLIC esmf - PRIVATE OM3_nuopc_cap_share OM3_share OM3_timing + PRIVATE AccessOM3::nuopc_cap_share AccessOM3::share AccessOM3::timing ) if(OpenMP_Fortran_FOUND) target_link_libraries(OM3_cmeps PRIVATE OpenMP::OpenMP_Fortran) @@ -50,9 +51,10 @@ target_sources(OM3_cmeps PRIVATE ## NUOPC cap share add_fortran_library(OM3_nuopc_cap_share mod/nuopc_cap_share STATIC) +add_library(AccessOM3::nuopc_cap_share ALIAS OM3_nuopc_cap_share) target_link_libraries(OM3_nuopc_cap_share PUBLIC esmf - PRIVATE OM3_share + PRIVATE AccessOM3::share ) target_sources(OM3_nuopc_cap_share PRIVATE CMEPS/cesm/nuopc_cap_share/driver_pio_mod.F90 diff --git a/CMakeLists.txt b/CMakeLists.txt index d7a28a3..a384e4b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -169,19 +169,19 @@ foreach(CONF IN LISTS KnownConfigurations) set(ComponentsTargets "") if(OM3_${CONF} MATCHES MOM6) - list(APPEND ComponentsTargets OM3_mom6) + list(APPEND ComponentsTargets AccessOM3::mom6) else() - list(APPEND ComponentsTargets OM3_cdeps_docn) + list(APPEND ComponentsTargets AccessOM3::cdeps_docn) endif() if(OM3_${CONF} MATCHES CICE6) - list(APPEND ComponentsTargets OM3_cice) + list(APPEND ComponentsTargets AccessOM3::cice) else() - list(APPEND ComponentsTargets OM3_cdeps_dice) + list(APPEND ComponentsTargets AccessOM3::cdeps_dice) endif() if(OM3_${CONF} MATCHES WW3) - list(APPEND ComponentsTargets OM3_ww3) + list(APPEND ComponentsTargets AccessOM3::ww3) else() - list(APPEND ComponentsTargets OM3_cdeps_dwav) + list(APPEND ComponentsTargets AccessOM3::cdeps_dwav) endif() # We use the CESM driver from CMEPS @@ -192,7 +192,7 @@ foreach(CONF IN LISTS KnownConfigurations) ) target_link_libraries(OM3_cesm_driver_${CONF} PUBLIC esmf - PRIVATE ${ComponentsTargets} OM3_cdeps_drof OM3_cdeps_datm OM3_cmeps OM3_nuopc_cap_share OM3_share OM3_timing + PRIVATE ${ComponentsTargets} AccessOM3::cdeps_drof AccessOM3::cdeps_datm AccessOM3::cmeps AccessOM3::nuopc_cap_share AccessOM3::share AccessOM3::timing ) target_compile_definitions(OM3_cesm_driver_${CONF} PRIVATE MED_PRESENT ATM_PRESENT @@ -204,7 +204,7 @@ foreach(CONF IN LISTS KnownConfigurations) ) add_executable(OM3_${CONF} CMEPS/CMEPS/cesm/driver/esmApp.F90) - target_link_libraries(OM3_${CONF} PRIVATE OM3_cesm_driver_${CONF} OM3_share esmf) + target_link_libraries(OM3_${CONF} PRIVATE OM3_cesm_driver_${CONF} AccessOM3::share esmf) set_target_properties(OM3_${CONF} PROPERTIES LINKER_LANGUAGE Fortran diff --git a/MOM6/CMakeLists.txt b/MOM6/CMakeLists.txt index 4f7fda8..59f30e9 100644 --- a/MOM6/CMakeLists.txt +++ b/MOM6/CMakeLists.txt @@ -11,6 +11,7 @@ endif() ## MOM6 library add_fortran_library(OM3_mom6 mod STATIC) +add_library(AccessOM3::mom6 ALIAS OM3_mom6) target_include_directories(OM3_mom6 PRIVATE $) if(OM3_MOM_SYMMETRIC) target_include_directories(OM3_mom6 PRIVATE $) @@ -20,7 +21,7 @@ endif() target_compile_options(OM3_mom6 PRIVATE "$<$:${fortran_compile_flags}>") target_link_libraries(OM3_mom6 PUBLIC esmf - PRIVATE OM3_nuopc_cap_share OM3_share FMS::fms_r8 + PRIVATE AccessOM3::nuopc_cap_share AccessOM3::share FMS::fms_r8 ) target_sources(OM3_mom6 PRIVATE MOM6/src/ALE/coord_adapt.F90 diff --git a/WW3/CMakeLists.txt b/WW3/CMakeLists.txt index 28417ff..ec29d86 100644 --- a/WW3/CMakeLists.txt +++ b/WW3/CMakeLists.txt @@ -12,6 +12,7 @@ endforeach() ## WW3 library add_fortran_library(OM3_ww3 mod STATIC) +add_library(AccessOM3::ww3 ALIAS OM3_ww3) target_compile_definitions(OM3_ww3 PRIVATE ENDIANNESS="big_endian") set_property(SOURCE WW3/model/src/w3initmd.F90 APPEND @@ -100,7 +101,7 @@ set_target_properties(OM3_ww3_grid PROPERTIES LINKER_LANGUAGE Fortran OUTPUT_NAME ww3_grid ) -target_link_libraries(OM3_ww3_grid PRIVATE OM3_ww3) +target_link_libraries(OM3_ww3_grid PRIVATE AccessOM3::ww3) # ww3_strt add_executable(OM3_ww3_strt WW3/model/src/ww3_strt.F90) @@ -108,7 +109,7 @@ set_target_properties(OM3_ww3_strt PROPERTIES LINKER_LANGUAGE Fortran OUTPUT_NAME ww3_strt ) -target_link_libraries(OM3_ww3_strt PRIVATE OM3_ww3) +target_link_libraries(OM3_ww3_strt PRIVATE AccessOM3::ww3) # ww3_outf add_executable(OM3_ww3_outf WW3/model/src/ww3_outf.F90) @@ -116,7 +117,7 @@ set_target_properties(OM3_ww3_outf PROPERTIES LINKER_LANGUAGE Fortran OUTPUT_NAME ww3_outf ) -target_link_libraries(OM3_ww3_outf PRIVATE OM3_ww3) +target_link_libraries(OM3_ww3_outf PRIVATE AccessOM3::ww3) # ww3_ounf add_executable(OM3_ww3_ounf) @@ -128,7 +129,7 @@ set_target_properties(OM3_ww3_ounf PROPERTIES LINKER_LANGUAGE Fortran OUTPUT_NAME ww3_ounf ) -target_link_libraries(OM3_ww3_ounf PRIVATE OM3_ww3) +target_link_libraries(OM3_ww3_ounf PRIVATE AccessOM3::ww3) # ww3_ounp add_executable(OM3_ww3_ounp WW3/model/src/ww3_ounp.F90) @@ -136,7 +137,7 @@ set_target_properties(OM3_ww3_ounp PROPERTIES LINKER_LANGUAGE Fortran OUTPUT_NAME ww3_ounp ) -target_link_libraries(OM3_ww3_ounp PRIVATE OM3_ww3) +target_link_libraries(OM3_ww3_ounp PRIVATE AccessOM3::ww3) ## Installs diff --git a/share/CMakeLists.txt b/share/CMakeLists.txt index d47f1fe..f7c4d53 100644 --- a/share/CMakeLists.txt +++ b/share/CMakeLists.txt @@ -2,6 +2,7 @@ ## share library add_fortran_library(OM3_share mod/share STATIC) +add_library(AccessOM3::share ALIAS OM3_share) target_include_directories(OM3_share PUBLIC CESM_share/include) if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU") target_compile_definitions(OM3_share PRIVATE CPRGNU NAMING=_ADD_UNDERSCORE FORTRANUNDERSCORE) @@ -10,7 +11,7 @@ elseif(CMAKE_Fortran_COMPILER_ID MATCHES "Intel") endif() target_link_libraries(OM3_share PUBLIC esmf PIO::PIO_Fortran - PRIVATE OM3_timing + PRIVATE AccessOM3::timing ) target_sources(OM3_share PRIVATE # The following files are generated with a script acting on templates @@ -53,6 +54,7 @@ endif() ## GPTL timing library add_fortran_library(OM3_timing mod/timing STATIC) +add_library(AccessOM3::timing ALIAS OM3_timing) target_compile_definitions(OM3_timing PRIVATE NUOPC_INTERFACE HAVE_MPI) if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU") target_compile_definitions(OM3_timing PRIVATE CPRGNU NAMING=_ADD_UNDERSCORE FORTRANUNDERSCORE)