Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CMake netCDF Compatibility with WPS (wrf-model#2121)
TYPE: bug fix KEYWORDS: compilation, cmake, netcdf SOURCE: internal DESCRIPTION OF CHANGES: Problem: PR wrf-model#2054 changes the netCDF target linking for WRF targets generated through CMake. When used with any other software relying on the package config generated from `cmake/template/WRFConfig.cmake`, there must be a way to find non-CMake supported packages like netCDF. WRF provides these find modules in `<install dir>/share` but does not use them within its own package config. WPS also has a FindnetCDF.cmake and FindnetCDF-Fortran.cmake, but these use the classic variable approach instead of an import target. Thus, when building WPS referencing WRF with the changes of wrf-model#2054, it will use the WPS netCDF find modules instead of WRF's. This will result in an error like: ``` CMake Error at /home/aislas/wrf-model/wrf/install/lib/cmake/WRF/WRFTargets.cmake:111 (set_target_properties): The link interface of target "WRF::io_netcdf" contains: netCDF::netcdff ``` Solution: Adjust the generated package config file to use WRF's find modules and give them precedence over WPS for WRF's imported targets specifically. Additionally, move imported target inclusion to after dependencies have been resolved so that WRF package finding precedence is used. TESTS CONDUCTED: 1. Tested with gcc/OpenMPI to build WRF and WPS (v4.6.0) together
- Loading branch information