FindMATLAB gets confused by texlive
I'm on Mac OS X 10.13, with cmake installed via homebrew.
After upgrading from cmake 3.10.2 to 3.12.3, I'm getting a new error after calling:
find_package(Matlab COMPONENTS MEX_COMPILER MX_LIBRARY ENG_LIBRARY) # --> Matlab_FOUND
(regardless of whether matlab is installed)
CMake Error at /usr/local/Cellar/cmake/3.12.3/share/cmake/Modules/FindMATLAB.cmake:1171 (file):
file STRINGS file "/usr/local/texlive/2017/bin/VersionInfo.xml" cannot be
read.
Call Stack (most recent call first):
/usr/local/Cellar/cmake/3.12.3/share/cmake/Modules/FindMATLAB.cmake:1433 (_Matlab_get_version_from_root)
CMakeLists.txt:9 (find_package)
CMake Error at /usr/local/Cellar/cmake/3.12.3/share/cmake/Modules/FindMATLAB.cmake:1173 (string):
string sub-command REGEX, mode MATCH needs at least 5 arguments total to
command.
Call Stack (most recent call first):
/usr/local/Cellar/cmake/3.12.3/share/cmake/Modules/FindMATLAB.cmake:1433 (_Matlab_get_version_from_root)
CMakeLists.txt:9 (find_package)
I think this script is getting confused because TexLive also installs an executable mex
(in my case at /Library/TeX/texbin/mex
). This cannot be used to reliably locate matlab.
FWIW, the FindMATLAB script of cmake 3.10 seemed to be working fine. Perhaps revert any changes?