[CMake] Compiling Matlab M files

elizabeta petreska elizabeta.petreska at gmail.com
Tue Feb 10 06:51:49 EST 2009


Hello
My problem is this :

I am having a set of matlab M files which need to be compiled with Matlab
compiler mcc.exe.
And I have separate directory for my matlab files which looks like this:

-MM
   --m files
  dummy.cpp
  cmakelists.txt


the cmakelists.txt inside the directory:

ADD_LIBRARY(MM STATIC dummy.cpp)
ADD_CUSTOM_COMMAND(TARGET MM PRE_BUILD
                 COMMAND mcc mcc -B cpplib:mylib ${MM_FILES}
                 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/matlab)

Before I built the MM target the custom command generates mylib.cpp ,mylib.h
,mylib.lib and mylib.dll.

The question is how to make the pre_build event to fire only if some of the
m files changes, i.e how to add file dependencies?
is this make sense?
Thank you
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090210/6b67f2cd/attachment.htm>


More information about the CMake mailing list