[CMAKE] Fail early if a lib header is missing, remove garbage in version
Summary:
This diff improves the UX when a library is missing:
- If the header is not found, there is no need to search for anything
else. find_package_handle_standard_args() is the only useful call to
indicate the failure with a nice error message.
- There is no need to set the version number to some garbage value. If
the version cannot be determined it should just remain unset.
Test Plan:
ninja check
Uninstall some library (miniupnpc was used for this test).
cmake -GNinja ..
Check it fails to find the lib and outputs a meaningful error message
(missing header)
Reinstall the library, then
cmake -GNinja .. # Don't nuke the cache !
Check the lib is now found.
ninja check
Reviewers: #bitcoin_abc, deadalnix
Reviewed By: #bitcoin_abc, deadalnix
Subscribers: deadalnix
Differential Revision: https://reviews.bitcoinabc.org/D6545