Guard install and find_package
This is a fix for coding style. The current code still works without this fix.
What is the bug
When Fortran-support is used as a subproject (e.g. in iconmath or in ragnarok), we might find or fetch the depending libraries multiple times. (Because these libraries are fetched in the parent project and cannot be found in config mode.)
Installing dependencies can also be messy as a subproject. An actual issue occurs with MemMan/Kokkos. We should only define install rules when the project is top level.
How do you fix it
Check whether the required target exists before finding or fetching the required library.
How urgent is the bugfix
- I need it as soon as possible
- I can wait for a couple of days
- None of my current codes is directly affected
Mandatory steps before review
- Gitlab CI passes
- Bugfix is covered by additional unit tests
- Mark the merge request as ready by removing
Draft:
Mandatory steps before merge
- Test coverage does not decrease
- Reviewed by a maintainer
- Incorporate review suggestions
- Remember to edit the commit message and select the proper changelog category (feature/bugfix/other)
You are not supposed to merge this request by yourself, the maintainers of fortran-support take care of this action!