find_dependency fails if <dep>_FOUND is cached
I use find_dependency
in my package config to find all dependencies. As find_dependency
now accepts find_package
arguments which are passed to the command directly, I use find_dependency
in conjunction with find modules as well.
The problem arises if <dep>_FOUND
is cached. In this case, find_package
is never called again by find_dependency
which in turn results in missing imported targets normally created by the corresponding find module.
The module which triggers the issue uses pkg_check_modules
from FindPkgConfig.cmake
to locate the libraries and pkg_check_modules
caches <dep>_FOUND
.