[CMake] find_package Module/Config mode and nontrivial package version checks

Joachim Wuttke j.wuttke at fz-juelich.de
Thu Oct 4 14:36:22 EDT 2018


The find_package command docs [1,2] recommend that user code
should generally look for packages using the Module mode
signature. What then about user code that ought to check
for version compatibility? Module mode only offers a check
for an EXACT version string, and does not terminate if
that condition is not met [3]. Users who need a newer-than
or same-major version check, or a strict enforcment of an
exact-version check, are advised to prefer packages that use
CMakePackageConfigHelpers to generate FooConfig[Version].cmake
files. These files, however, are ignored unless Config mode
is chosen.

Is this summary correct? Shouldn't then the general recommendation
of Module mode be qualified?

- Joachim

[1] https://cmake.org/cmake/help/v3.12/command/find_package.html
[2] https://gitlab.kitware.com/cmake/cmake/merge_requests/2446
[3] https://stackoverflow.com/questions/52633455


-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5110 bytes
Desc: S/MIME Cryptographic Signature
URL: <https://cmake.org/pipermail/cmake/attachments/20181004/8b9ed5a6/attachment.bin>


More information about the CMake mailing list