[CMake] Compiling Matlab M files

elizabeta petreska elizabeta.petreska at gmail.com
Tue Feb 10 08:05:17 EST 2009


Ok I think I found solution maybe the answer is to use ADD_CUSTOM_COMMAND
with DEPENDS

On Tue, Feb 10, 2009 at 12:51 PM, elizabeta petreska <
elizabeta.petreska at gmail.com> wrote:

> 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/162a771a/attachment.htm>


More information about the CMake mailing list