Skip to content

FindMatlab: Support REGISTRY_VIEW for find_package and helper functions

CMake 3.24 added REGISTRY_VIEW as find_package argument. Since FindMatlab.cmake looks up the registry, we might as well support it.

This MR adds providing an optional REGISTY_VIEW argument to the following functions:

  • find_package(Matlab ...), default to TARGET
  • matlab_extract_all_installed_versions_from_registry(...), default to nothing (i.e. BOTH)
  • matlab_get_all_valid_matlab_roots_from_registry(...), default to nothing (i.e. BOTH)

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.

Edited by Hermann von Kleist

Merge request reports