From 2f43ba507397a6d13924a592d4ebd86d7df8a2ef Mon Sep 17 00:00:00 2001 From: Vincent Newsum Date: Wed, 22 Sep 2021 09:43:56 +0200 Subject: FindMatlab: Sort available Matlab versions using natural comparison. On Windows, when FindMatlab.cmake searches the registry for installed Matlab versions, it sorts these versions alphabetically. Since Matlab 2021a (version 9.10) came out this became a problem as now version 9.10 is placed after 9.1 instead of after a higher version less than 9.10. The result is that FindMatlab doesn't return the highest version by default. This fix uses the natural sort comparison which was introduced in CMake 3.18. --- Modules/FindMatlab.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules/FindMatlab.cmake b/Modules/FindMatlab.cmake index 12a5fde..e4fcd83 100644 --- a/Modules/FindMatlab.cmake +++ b/Modules/FindMatlab.cmake @@ -477,7 +477,7 @@ function(matlab_extract_all_installed_versions_from_registry win64 matlab_versio if(matlabs_from_registry) list(REMOVE_DUPLICATES matlabs_from_registry) - list(SORT matlabs_from_registry) + list(SORT matlabs_from_registry COMPARE NATURAL) list(REVERSE matlabs_from_registry) endif() @@ -521,7 +521,7 @@ macro(extract_matlab_versions_from_registry_brute_force matlab_versions) # we order from more recent to older if(matlab_supported_versions) list(REMOVE_DUPLICATES matlab_supported_versions) - list(SORT matlab_supported_versions) + list(SORT matlab_supported_versions COMPARE NATURAL) list(REVERSE matlab_supported_versions) endif() -- cgit v0.12