Restructure netCDF find modules to use modern import target (#2054)
commit1e96a7ec92fc20174232a55e0eb10e285e6b6016
authorAnthony Islas <128631809+islas@users.noreply.github.com>
Mon, 14 Oct 2024 22:51:31 +0000 (14 15:51 -0700)
committerGitHub <noreply@github.com>
Mon, 14 Oct 2024 22:51:31 +0000 (14 15:51 -0700)
treed3d330ab704a6fd11ed6fcc599e420e1dd84241a
parentf68f0b94762d2af577a2e68c98a67f5871cda083
Restructure netCDF find modules to use modern import target (#2054)

TYPE: enhancement

KEYWORDS: netCDF, cmake, compilation

SOURCE: internal

DESCRIPTION OF CHANGES:
Problem:
The current iteration of the cmake build uses the old-style of finding
modules. This limits the usability of transitive properties as well as
the native netCDF cmake build which provide imported targets.

See
https://cmake.org/cmake/help/latest/manual/cmake-developer.7.html#find-modules
for more information on module writing.

Solution:
Augment the output of the provided find module to supply an imported
target that fully describes the netCDF library. Additionally, in
rewriting how targets in WRF reference netCDF remove unnecessary linking
to the library. Ensure the provided import target and flags of the find
module matches the netCDF[-Fortran].cmake.in outputs verbatim thus
emulating the native netCDF build for additional robustness.

LIST OF MODIFIED FILES:
M       CMakeLists.txt
M       cmake/modules/FindnetCDF-Fortran.cmake
M       cmake/modules/FindnetCDF.cmake
M       external/CMakeLists.txt
M       external/RSL_LITE/CMakeLists.txt
M       external/atm_ocn/CMakeLists.txt
M       external/esmf_time_f90/CMakeLists.txt
M       external/fftpack/fftpack5/CMakeLists.txt
M       external/io_adios2/CMakeLists.txt
M       external/io_esmf/CMakeLists.txt
M       external/io_grib1/CMakeLists.txt
M       external/io_grib1/MEL_grib1/CMakeLists.txt
M       external/io_grib1/WGRIB/CMakeLists.txt
M       external/io_grib1/grib1_util/CMakeLists.txt
M       external/io_grib2/bacio-1.3/CMakeLists.txt
M       external/io_grib2/g2lib/CMakeLists.txt
M       external/io_grib_share/CMakeLists.txt
M       external/io_netcdf/CMakeLists.txt
M       external/io_netcdfpar/CMakeLists.txt

RELEASE NOTE:
Restructure netCDF find modules to use modern import target
27 files changed:
CMakeLists.txt
cmake/modules/FindnetCDF-Fortran.cmake
cmake/modules/FindnetCDF.cmake
external/CMakeLists.txt
external/RSL_LITE/CMakeLists.txt
external/atm_ocn/CMakeLists.txt
external/esmf_time_f90/CMakeLists.txt
external/fftpack/fftpack5/CMakeLists.txt
external/io_adios2/CMakeLists.txt
external/io_esmf/CMakeLists.txt
external/io_grib1/CMakeLists.txt
external/io_grib1/MEL_grib1/CMakeLists.txt
external/io_grib1/WGRIB/CMakeLists.txt
external/io_grib1/grib1_util/CMakeLists.txt
external/io_grib2/bacio-1.3/CMakeLists.txt
external/io_grib2/g2lib/CMakeLists.txt
external/io_grib_share/CMakeLists.txt
external/io_netcdf/CMakeLists.txt
external/io_netcdfpar/CMakeLists.txt
hydro/CMakeLists.txt
hydro/HYDRO_drv/CMakeLists.txt
hydro/IO/CMakeLists.txt
hydro/Routing/CMakeLists.txt
hydro/Routing/Reservoirs/CMakeLists.txt
hydro/Routing/Reservoirs/Persistence_Level_Pool_Hybrid/CMakeLists.txt
hydro/Routing/Reservoirs/RFC_Forecasts/CMakeLists.txt
hydro/nudging/CMakeLists.txt