Skip to content

find_package: Restore longer message when config files were considered

Since !851 (merged) we print only the one line

- Could NOT find Foo (missing: Foo_DIR)

when package Foo cannot be found in CONFIG mode and it is not REQUIRED. However, in the case that package configuration files were found but not used, this one line message leaves out important information. This can happen when a package configuration file sets Foo_FOUND to FALSE or when its package version file does not match the requested version. Restore the longer message in these cases. Otherwise a seemingly valid explicit Foo_DIR setting appears to be silently ignored even if it was considered.

Fixes: #17029 (closed)

Merge request reports