Wojciech Jarosz wrote:
> I saw a couple questions regarding this in the archives from a few
> years, but no answers.
> 
> I am using CMake for my project, and would now like to write a matlab
> mex function which would use my C/C++ code base. I'd like to have the
> CMake infrastructure figure out the correct -I,-L,-l flags to pass to
> the mex compiler so everything compiles/links correctly. Has anyone done
> this before? I'm primarily using Linux.

FIND_PACKAGE(Matlab)
INCLUDE_DIRECTORIES(${MATLAB_INCLUDE_DIR})
ADD_LIBRARY(mymex MODULE mymex.c)
TARGET_LINK_LIBRARIES(mymex ${MATLAB_LIBRARIES})

See also "bin/cmake --help-module FindMatlab".

It looks like the matlab module is a bit out of date so let us know if
you have problems.

-Brad
_______________________________________________
CMake mailing list
[email protected]
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to