HomePhabricator

[CMAKE] Fix version mismatch during crosscompilation due to pkg-config

Description

[CMAKE] Fix version mismatch during crosscompilation due to pkg-config

Summary:
The pkg config file is used for some cmake modules to help finding the
libraries. This is used as a last resort for searching paths to headers
and libraries, but it is also used to determine the version for some
libraries where there is no better way.
This can cause a mismatch if the library is found without the need for
pkg-config, but pkg-config also found the library as the version can be
used in place of the one from the found library. During a cross
compilation this can cause a mismatch between the library found from the
depends and the version reported by pkg-config, from the host.
This diff adds a check so that the pkg-config version is only used when
the library path match the pkg-config path to prevent any mismatch.

Test Plan:
On Ubuntu Xenial:

cmake -GNinja .. -DCMAKE_TOOLCHAIN_FILE=../cmake/platforms/Linux64.cmake
ninja

Check that libevent is found. The version will be 99.99.99 because there
is no way to determine the correct event version during
crosscompilation. Before this patch cmake reported an error due to an
insufficient libevent version 2.0.21 (the system version).

Reviewers: #bitcoin_abc, jasonbcox

Reviewed By: #bitcoin_abc, jasonbcox

Differential Revision: https://reviews.bitcoinabc.org/D7719

Details

Provenance
FabienAuthored on Oct 1 2020, 16:08
FabienPushed on Oct 2 2020, 06:13
Reviewer
Restricted Project
Differential Revision
D7719: [CMAKE] Fix version mismatch during crosscompilation due to pkg-config
Parents
rABC85f266319f58: Revert recent coin selection changes
Branches
Unknown
Tags
Unknown