Fix package config missing the OpenMP dependency
What is the bug
Consuming an OpenMP-enabled iconmath via find_package(iconmath) fails at
the consumer's configure time:
CMake Error: The link interface of target "iconmath::support" contains:
OpenMP::OpenMP_Fortran
but the target was not found.Since !93 (merged) the Fortran libraries link OpenMP::OpenMP_Fortran as a target.
The links are PRIVATE, but for static libraries they are still exported in
the link interface (as $<LINK_ONLY:...>), and CMake requires the imported
target to exist when the consumer loads iconmath-targets.cmake. The
generated package config never declares OpenMP, so consumers that have not
found OpenMP themselves cannot load the package at all.
How do you fix it
Add find_dependency(OpenMP REQUIRED COMPONENTS Fortran) to
cmake/config.cmake.in, mirroring the find_package call in the top-level
CMakeLists.txt. It is nested inside the existing IM_ENABLE_FORTRAN guard
and additionally guarded by IM_ENABLE_OPENMP, so OpenMP-off and C++-only
builds are unaffected. No location hint is needed: OpenMP is resolved by
compiler introspection, not a package directory.
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 (Hint: use
make formatfor linting) - Bugfix is covered by additional unit tests
- Mark the merge request as ready by removing
Draft:
Mandatory steps before merge
- 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 libiconmath take care of this action!