Skip to content

Commit 2e0694f

Browse files
authored
Rework the dependency linking of hydro CMake compilation (#2178)
TYPE: bug fix KEYWORDS: cmake, hydro SOURCE: internal DESCRIPTION OF CHANGES: Problem: Some dependencies were not being fully satisfied and were implicit / partially fulfilled by subsequent compilation. In compilers that could tolerate these situations the hydro folder would compile successfully. However, for compilers where dependencies are enforced (i.e. symbols resloved at compile time even within Fortran submodules), compilation would fail. Solution: To account for situations where compilers require all module dependencies be resolved, dependencies between the hydro libraries and the transitive link properties were reworked to propagate dependencies up the chain correctly. TESTS CONDUCTED: 1. Tested building hydro with Intel oneAPI ifx 2024.2.1 RELEASE NOTE: Fixed failed compilation with Intel oneAPI by reworking the dependency linking of hydro CMake compilation
1 parent a176a59 commit 2e0694f

File tree

8 files changed

+9
-3
lines changed

8 files changed

+9
-3
lines changed

hydro/CPL/WRF_cpl/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ add_dependencies(hydro_wrf_cpl
1414
MPI::MPI_Fortran
1515
)
1616

17+
target_link_libraries( hydro_wrf_cpl PRIVATE hydro_driver )
18+
1719
target_include_directories(hydro_wrf_cpl
1820
PRIVATE
1921
$<TARGET_PROPERTY:${PROJECT_NAME}_Core,Fortran_MODULE_DIRECTORY>

hydro/Data_Rec/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ add_library(hydro_data_rec STATIC
55
module_RT_data.F90
66
module_namelist.F90
77
)
8+
target_link_libraries( hydro_data_rec PRIVATE hydro_mpp )

hydro/Debug_Utilities/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
add_library(hydro_debug_utils STATIC
33
debug_dump_variable.F90
44
)
5+
target_link_libraries( hydro_debug_utils PRIVATE hydro_mpp )

hydro/HYDRO_drv/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ target_link_libraries(hydro_driver PUBLIC
88
hydro_data_rec
99
hydro_routing
1010
hydro_debug_utils
11-
PRIVATE
12-
netCDF::netcdff
11+
netCDF::netcdff
1312
)
1413

1514
if(WRF_HYDRO_NUDGING STREQUAL "1")

hydro/IO/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ add_library(hydro_netcdf_layer STATIC
44
)
55

66
target_link_libraries(hydro_netcdf_layer
7+
PUBLIC
78
MPI::MPI_Fortran
89
netCDF::netcdff
910
)

hydro/MPP/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ add_library(hydro_mpp STATIC
66
hashtable.F90
77
)
88

9-
target_link_libraries(hydro_mpp MPI::MPI_Fortran)
9+
target_link_libraries(hydro_mpp PUBLIC MPI::MPI_Fortran)
1010
target_include_directories(hydro_mpp PUBLIC
1111
${MPI_Fortran_MODULE_DIR}
1212
)

hydro/Routing/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ add_library(hydro_routing STATIC
1818
)
1919

2020
target_link_libraries(hydro_routing
21+
PRIVATE
2122
MPI::MPI_Fortran
2223
netCDF::netcdff
2324
hydro_mpp

hydro/utils/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ add_library(hydro_utils STATIC
1818
module_version.F90
1919
module_hydro_stop.F90
2020
)
21+
target_link_libraries(hydro_utils PRIVATE MPI::MPI_Fortran)

0 commit comments

Comments
 (0)