[ENH] find_package: enhance version specification
find_package
version specification offers two possibilities:
- minimum required version: in this case, the most recent version founded, respecting the minimum specified, is selected
- exact version: in this case, the version must be specified completely
In practice, these capabilities are not flexible enough: it is not possible to request, for example, some specific major version regardless other values of the version (minor, patch, etc...) which is quite common when multiple major versions are installed.
Offering the possibility to specify the version as a range will remove this limitation. For the syntax, same approach as cmake_minimum_required
can be used to ensure compatibility with CMake
older versions:
find_package (myPackage 3.0...3.99)
This command will request any version 3, assuming there will never have version 3
superior to 3.99
. To enhance further, the upper value can be excluded from the range for a more flexible way to specify requested versions:
find_package (myPackage 3.0...4.0)
Which means [3.0, 4.0)
(includes 3.0 and excludes 4.0).
This global enhancement to package management will enable to solve #21107 (closed).