summaryrefslogtreecommitdiff
path: root/Modules/FindMatlab.cmake
diff options
context:
space:
mode:
authorVincent Newsum <vynewsum@gmail.com>2021-09-22 09:43:56 +0200
committerVincent Newsum <vynewsum@gmail.com>2021-09-22 09:43:56 +0200
commit2f43ba507397a6d13924a592d4ebd86d7df8a2ef (patch)
treea96fa6202910197fd6387ad3ca5b9e104a93650e /Modules/FindMatlab.cmake
parent60caed1bd646a7efbf045d55e80286c0cf28c685 (diff)
downloadcmake-2f43ba507397a6d13924a592d4ebd86d7df8a2ef.tar.gz
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.
Diffstat (limited to 'Modules/FindMatlab.cmake')
-rw-r--r--Modules/FindMatlab.cmake4
1 files changed, 2 insertions, 2 deletions
diff --git a/Modules/FindMatlab.cmake b/Modules/FindMatlab.cmake
index 12a5fde7e6..e4fcd839a1 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()