Page MenuHomePhabricator

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

Authored by Fabien on Jun 12 2020, 09:43.

Details

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

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Fabien requested review of this revision.Jun 12 2020, 09:43
deadalnix added a subscriber: deadalnix.

The fact a very similar chage had to be done in so many places hints at the fact that some factoring is in order.

This revision is now accepted and ready to land.Jun 12 2020, 12:22