Find_matlab fails with cannot find Matlab_MEX_LIBRARY Matlab_MEX_EXTENSION and Matlab_MX_LIBRARY
Hello CMake Folks, I am using cmake-3.21.1 and matlab 9.5(64 bit), Windows and mingw64 as makefile generator. I am not using anything else but using find_matlb to get the location of matlab.exe. find_package(Matlab 9.5 OPTIONAL_COMPONENTS MEX_COMPILER ENG_LIBRARY MCC_COMPILER SIMULINK) if (MATLAB_FOUND) message("Do something") else message("Do nothing") endif() But find_matlab cannot find Matlab_MEX_LIBRARY Matlab_MEX_EXTENSION and Matlab_MX_LIBRARY I added SET(CMAKE_FIND_DEBUG_MODE ON) set(MATLAB_FIND_DEBUG TRUE)
and noticed the following :
-- [MATLAB] Matlab root folders are MATLAB;9.5;C:/Program Files/MATLAB/R2018b -- [MATLAB] Current version is 9.5 located C:/Program Files/MATLAB/R2018b CMake Debug Log at C:/Program Files/CMake/share/cmake-3.21/Modules/FindMatlab.cmake:611 (find_program): find_program called with the following settings:
VAR: Matlab_MEXEXTENSIONS_PROG
NAMES: "mexext"
Documentation: Matlab MEX extension provider
Framework
Only Search Frameworks: 0
Search Frameworks Last: 0
Search Frameworks First: 0
AppBundle
Only Search AppBundle: 0
Search AppBundle Last: 0
Search AppBundle First: 0
NO_DEFAULT_PATH Enabled
find_program considered the following locations:
C:/Program Files/MATLAB/R2018b/bin/mexext.com
C:/Program Files/MATLAB/R2018b/bin/mexext.exe
C:/Program Files/MATLAB/R2018b/bin/mexext
The item was not found.
CMake Debug Log at C:/Program Files/CMake/share/cmake-3.21/Modules/FindMatlab.cmake:1692 (find_library): find_library called with the following settings:
VAR: Matlab_MEX_LIBRARY
NAMES: "mex"
Documentation: Path to a library.
Framework
Only Search Frameworks: 0
Search Frameworks Last: 0
Search Frameworks First: 0
AppBundle
Only Search AppBundle: 0
Search AppBundle Last: 0
Search AppBundle First: 0
NO_DEFAULT_PATH Enabled
find_library considered the following locations:
C:/Program Files/MATLAB/R2018b/bin/win64/(lib|lib)mex(\.so|\.a)
C:/Program Files/MATLAB/R2018b/extern/bin/win64/(lib|lib)mex(\.so|\.a)
The item was not found. I am wondering why is it looking for .so or .a while it should look for .dll. Could someone please help me?