HomePhabricator

[CMAKE] Fail early if a lib header is missing, remove garbage in version

Description

[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

Details

Provenance
FabienAuthored on Jun 12 2020, 09:35
FabienPushed on Jun 12 2020, 16:01
Reviewer
Restricted Project
Differential Revision
D6545: [CMAKE] Fail early if a lib header is missing, remove garbage in version
Parents
rABCae5e07f4111a: [CMAKE] Don't require jemalloc for systems where it's the default
Branches
Unknown
Tags
Unknown