Ok I think I found solution&nbsp;<div>maybe the answer is to use ADD_CUSTOM_COMMAND with DEPENDS<br><div><br><div class="gmail_quote">On Tue, Feb 10, 2009 at 12:51 PM, elizabeta petreska <span dir="ltr">&lt;<a href="mailto:elizabeta.petreska@gmail.com">elizabeta.petreska@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hello<div><br></div><div>My problem is this :</div><div><br></div><div>I am having a set of matlab M files which need to be compiled with Matlab compiler mcc.exe.</div>
<div>And I have separate directory for my matlab files which looks like this:</div>
<div><br></div><div>-MM</div><div>&nbsp;&nbsp; --m files</div><div>&nbsp;&nbsp;dummy.cpp</div><div>&nbsp;&nbsp;cmakelists.txt</div><div><br></div><div><br></div><div>the cmakelists.txt inside the directory:</div><div><br></div><div>ADD_LIBRARY(MM STATIC dummy.cpp)<br>

</div><div><div>ADD_CUSTOM_COMMAND(TARGET MM PRE_BUILD &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; COMMAND mcc mcc -B cpplib:mylib ${MM_FILES}</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/matlab)</div>

<div><br></div><div>Before I built the MM target the custom command generates mylib.cpp ,mylib.h ,mylib.lib and mylib.dll.</div><div><br></div><div>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?</div>

<div>is this make sense?</div><div>Thank you</div><div><br></div><div><br></div></div>
</blockquote></div><br></div></div>