diff options
author | Hermann von Kleist <hermann.von.kleist@ivi.fraunhofer.de> | 2024-01-12 13:18:53 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2024-01-12 14:38:12 (GMT) |
commit | 694727bb45eaf639296fd1c93d1d4747236ad5c2 (patch) | |
tree | 9803c919ac9db2f956ec764ef720777e7741b194 | |
parent | 01e3eb91b85b6d9c622998bc9b3e29168ebe0c5a (diff) | |
download | CMake-694727bb45eaf639296fd1c93d1d4747236ad5c2.zip CMake-694727bb45eaf639296fd1c93d1d4747236ad5c2.tar.gz CMake-694727bb45eaf639296fd1c93d1d4747236ad5c2.tar.bz2 |
FindMatlab: Restore support for versions without VersionInfo.xml
Report "unknown" in `_Matlab_VersionInfoXML` if file is missing.
Fix omitted MATLAB root with unknown version from XML.
Fixes: #25585
Fixes: #25586
-rw-r--r-- | Modules/FindMatlab.cmake | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/Modules/FindMatlab.cmake b/Modules/FindMatlab.cmake index b90a45f..c5379d5 100644 --- a/Modules/FindMatlab.cmake +++ b/Modules/FindMatlab.cmake @@ -503,6 +503,8 @@ function(matlab_extract_all_installed_versions_from_registry win64 matlab_versio _Matlab_VersionInfoXML("${_reg}" _matlab_version_tmp) if(NOT "${_matlab_version_tmp}" STREQUAL "unknown") list(APPEND matlabs_from_registry ${_matlab_version_tmp}) + else() + list(APPEND matlabs_from_registry ${match}) endif() endforeach() @@ -1409,21 +1411,20 @@ function(_Matlab_VersionInfoXML matlab_root _version) set(_ver "unknown") set(_XMLfile ${matlab_root}/VersionInfo.xml) - if(NOT EXISTS ${_XMLfile}) - return() - endif() + if(EXISTS ${_XMLfile}) - file(READ ${_XMLfile} versioninfo_string) + file(READ ${_XMLfile} versioninfo_string) - if(versioninfo_string) - # parses "<version>23.2.0.2365128</version>" - string(REGEX MATCH "<version>([0-9]+(\\.[0-9]+)+)</version>" - version_reg_match - ${versioninfo_string} - ) + if(versioninfo_string) + # parses "<version>23.2.0.2365128</version>" + string(REGEX MATCH "<version>([0-9]+(\\.[0-9]+)+)</version>" + version_reg_match + ${versioninfo_string} + ) - if(CMAKE_MATCH_1) - set(_ver "${CMAKE_MATCH_1}") + if(CMAKE_MATCH_1) + set(_ver "${CMAKE_MATCH_1}") + endif() endif() endif() |