When loading packages using find_package(...) in cmake the version file has to declare 5 variables. Two of them are
according to the documentation they are used for
PACKAGE_VERSION_COMPATIBLE
True if version is compatible
PACKAGE_VERSION_UNSUITABLE
True if unsuitable as any version
Which leaves me puzzled. PACKAGE_VERSION_UNSUITABLE has been introduced in CMake 2.6.2 . However it seems mutually exclusive to PACKAGE_VERSION_COMPATIBLE. So why does it exist?
Can somebody enlighten me about the difference between being compatible and (un)suitable and maybe give an example, where both values are either true or false?
Probably too late, but for the sake of great justice:
There are three variables checking version:
PACKAGE_VERSION_EXACT, PACKAGE_VERSION_COMPATIBLE and PACKAGE_VERSION_UNSUITABLE.
You can find logic behind this variables here: https://github.com/Kitware/CMake/blob/0ae545ebad1b6b2a6c851205854b887d19c8da59/Source/cmFindPackageCommand.cxx#L1270
I'll try to reword. Note that I cut variable names for readability. Let's boil it down to four cases:
UNSUITABLE set: discard package regardless other variablesUNSUITABLE not set, EXACT not set, COMPATIBLE not set: package is good if find_package did not request version (it doesn't matter with or without EXACT)UNSUITABLE not set, EXACT not set, COMPATIBLE set: package is good if find_package did not require EXACT versionUNSUITABLE not set, EXACT set: package is goodSo, PACKAGE_VERSION_COMPATIBLE and PACKAGE_VERSION_UNSUITABLE are not exclusive:
PACKAGE_VERSION_UNSUITABLE discards package unconditionallyPACKAGE_VERSION_COMPATIBLE permits package only if EXACT not set and has no effect if find_package did not request versionHope that helped =)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With