Re: Cmake + Matlab mex

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Re: Cmake + Matlab mex

Matt McCormick
> ..., but what I want to do is compile a file
> for use in Matlab using the mex compiler. I can do this by hand by
> executing the following in a shell:
> $ mex foo.cpp
> This would produce a foo.mexglx binary which matlab would be able to use.
> This is great if your foo.cpp is self-contained, however my foo.cpp
> depends on libraries and include files which I generate in my CMake
> build. Manually what I would do to handle this is:
> $ mex -I/my/include/path -L/my/library/path -lmylib ... foo.cpp
> I would like to make a CMake target which does the command above, taking
> into account any library or include dependencies I specify in my
> CMakeLists.txt. Is this possible?

I have implemented this behavior.  Please see

Kick the tires.
I have tried this on Linux and WindowsXP, and it seems works in these cases, at
least on my system.

Powered by

Visit other Kitware open-source projects at

Please keep messages on-topic and check the CMake FAQ at:

Follow this link to subscribe/unsubscribe: