I have CMake version 3.23.0-rc1 installed with installer and I have problems with findMatlab. I have copied latest version of findMatlab.cmake from github, but still the same error remains:
CMake Error at C:/Program Files/CMake/share/cmake-3.23/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find Matlab (missing: Matlab_MEX_LIBRARY Matlab_MX_LIBRARY)
(found version “9.11”)
Call Stack (most recent call first):
C:/Program Files/CMake/share/cmake-3.23/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
C:/Program Files/CMake/share/cmake-3.23/Modules/FindMatlab.cmake:1946 (find_package_handle_standard_args)
I am trying to compile a mex file with MinGW compiler, the mex library is in extern\lib\win64\mingw64\libmex.lib
the header file mex.h is in extern\include\mex.h
Maybe the Matlab_EXTERN_BINARIES_DIR is not currently correctly set?
Printed out some variables and It seems that _matlab_64Build variable is not correctly set. EXTERN_LIBRARY_DIR is set to extern/lib/win32.
It turns out the problem was user stupidity - I had path to MinGW32 compiler set in environment variables and was causing the mixup myself. Business as usual.
I have no problems in linux and absolutely love the matlab_add_mex function this findMatlab provides. It would be perfect if it would work in Windows also.