[cmake-developers] Support for version suffixes
Brad King
brad.king at kitware.com
Tue Mar 28 09:18:38 EDT 2017
On 03/27/2017 05:03 PM, Roger Leigh wrote:
> I'd like to bring this issue to your attention to canvas some feedback
> regarding the use of version suffixes:
>
> https://gitlab.kitware.com/cmake/cmake/issues/16716
>
> The proposal linked above contains a much more detailed rationale and
> suggested implementation strategy. I'd be very happy to hear any
> thoughts anyone has regarding this either on the above issue, or here.
Thanks for starting this thread. I agree it would be nice to do more
general version comparisons. However, I think more design work is
needed first.
Currently we have:
* cmSystemTools::VersionCompare compares leading unsigned integer
components separated by `.` and ignores suffixes. This is used
by VERSION_LESS and such.
* cmSystemTools::strverscmp implements the strverscmp(3) function.
This will happen to include suffixes in the version comparison due
to a very clever definition of the comparison function, but it does
not specifically treat suffixes as special. It is also compatible
with cmSystemTools::VersionCompare unless an integer component has
leading zeros. It is used by `CMAKE_FIND_PACKAGE_SORT_ORDER`, but
otherwise we have no way to access it from the CMake language.
There are several version comparison conventions out there that interpret
suffixes in some way. For example, PEP 440 [1]. I'd like to see a
summary of such schemes that are widely used.
Since CMake code often ends up comparing versions of other projects,
we may even need to implement several comparison functions and provide
a more general interface to specify which one to use for a given check.
Thanks,
-Brad
[1] https://www.python.org/dev/peps/pep-0440/#version-scheme
More information about the cmake-developers
mailing list