I would like to compile MEX-files (MATLAB executable) in CLion instead of in MATLAB (which gives no help on writing C code). However, MEX-files require the #include mex.h(pp), which is not available on normal C++. Moreover, the format, which does not have a main
function, is different.
I am using MATLAB R2018b and hoping to use C++11 using the new C++ API for MEX-files. However, I would be able to use the old API as well.
I have tried looking at CMake's FindMatlab module and in several other locations. However, most other guides are out of date and even their reference links do not connect to their original pages.
I am an absolute newbie at CMake and I don't know where to begin.
I am currently unable to use #include "mex.h"
, #include "mex.hpp"
, #include "mexAdapter.hpp"
etc. I am also unable to compile a function without a main
function.
Many thanks in advance for anyone who can help by uploading or describing the CMakeLists.txt
file that would be necessary.