CMake 3.24 added REGISTRY_VIEW as find_package argument. Since
FindMatlab.cmake looks up the registry, we might as well support it.
While some logic existed to select the correct registry view when
searching for the installed versions, that logic was not applied when
getting the matlab root directories, which might have led to weird
situations in which both the 32-bit and 64-bit version of the same
Matlab release were installed simultaneously.
The changes made in this commit try not to break existing and documented
behavior from exposed functions. The exposed functions which interact
with the registry get an optional `REGISTRY_VIEW` argument.
If no REGISTRY_VIEW is passed to find_package, FindMatlab uses the
`TARGET` view to mimic the previous behavior.
`matlab_extract_all_installed_versions_from_registry` searched for
32-bit installations on 32-bit Windows even if win64 was set to 'TRUE'.
Now, no installation will be found if win64 is set to 'TRUE' on 32-bit
Windows, which is also the documented behavior.
c273fc4ffb FindMatlab: Handle version range
3665fe26ba FindMatlab: Refactor version selection using find_package_check_version
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9221
Partially revert commit dc9d9589e4 (FindMatlab:WIN32: return full Matlab
version when found via registry, 2023-09-14, v3.28.0-rc1~82^2~2). It
changed `matlab_extract_all_installed_versions_from_registry` behavior
to query `VersionInfo.xml` for version information. However, the
function documentation states that it only uses the registry. It's also
not needed since commit c608adc236 (FindMatlab: Fix major.minor version
lookups in Windows Registry, 2024-01-11, v3.28.2~13^2~1), which added
the same lookup to `matlab_get_all_valid_matlab_roots_from_registry`.
This adds -w to to the version source file's compile options.
Currently, this is done for Clang and compilers officially supported by
Matlab.
Fixes: #24851
b8665d44ba FindMatlab: Fix error message from function
44d2cf3ed4 FindMatlab: Document all registry paths for version lookup
363a7d4693 FindMatlab: matlab_get_release_name_from_version is a function now
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: scivision <michael@scivision.dev>
Merge-request: !9175
Fix logic from commit fff5c1507e (FindMatlab: refactor: use registry
query instead of execute_process, 2023-09-14, v3.28.0-rc1~82^2~7)
to work when multiple versions are found in the registry.
Issue: #25497
Fix logic from commit dc9d9589e4 (FindMatlab:WIN32: return full Matlab
version when found via registry, 2023-09-14, v3.28.0-rc1~82^2~2) to
avoid assuming that a registry entry always exists and is non-empty.
Fixes: #25497
On Windows,
instead of executing "reg query" it's much simpler and more robust
to use cmake's built in registry query.
Remove unused variables. Significantly reduces amount of code in
function.