list: Add a NUMERIC method to SORT
I have a list of numbers that have been sorted alphabetically:
1.1;10.0;11.0;12.0;12.1;2.0;2.1;3.0;3.1;3.2;4.0;4.1;5.0;5.1;5.2;6.0;6.1;6.2;6.3;7.0;8.0;9.0
I would like them to be sorted numerically:
1.1.1;2.0;2.1;3.0;3.1;3.2;4.0;4.1;5.0;5.1;5.2;6.0;6.1;6.2;6.3;7.0;8.0;9.0;10.0;11.0;12.0;12
list(SORT) currently has STRING
and FILE_BASENAME
comparison methods, but no methods to do a numerical sort. Writing a function for this is also quite cumbersome since CMake doesn't really support math with real numbers. I think the addition of a NUMERIC
or NUMERICAL
method would make this a lot easier.
It may also be useful to have a VERSION
method, similator to the VERSION_<comp>
supported by if statements.
Edited by Brad King