CMake netCDF Compatibility with WPS #2121
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
TYPE: bug fix
KEYWORDS: compilation, cmake, netcdf
SOURCE: internal
DESCRIPTION OF CHANGES:
Problem:
PR #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 #2054, it will use the WPS netCDF find modules instead of WRF's. This will result in an error like:
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: