<div dir="ltr"><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Apr 1, 2014 at 12:55 PM, Nils Gladitz <span dir="ltr"><<a href="mailto:nilsgladitz@gmail.com" target="_blank">nilsgladitz@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class=""><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
SET (MY_SRC Event_log.h other.cpp other1.cpp)<br>
<br>
ADD_EXECUTABLE(MyExe ${MY_SRC }<br>
<br>
add_custom_command(OUTPUT Event_log.h COMMAND mc Event_log.mc<br>
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DEPENDS Event_log.mc)<br>
<br>
Whenever I run the build command, this causes the "mc" to rerun each<br>
time (even if the .mc file is not changed), and in effect recompiling a<br>
major portion of my project.<br>
<br>
May I know what am I doing wrong here?<br>
</blockquote>
<br></div>
The OUTPUT path is relative to the current binary directory.<br>
Since you set the WORKING_DIRECTORY to the current source directory (I assume this is where the output actually goes) the actual output path and the output you specified don't match up.<br>
<br>
This causes to command to rerun every time since the output as specified is never created.<br>
<br>
I would generate the output in the binary directory rather than the source directory if possible so that separate parallel build directories for the same source directory still work as intended.<span class=""><font color="#888888"><br>
<br>
Nils<br>
</font></span></blockquote></div><br></div><div class="gmail_extra"><br></div><div class="gmail_extra">Thanks it solved the problem<br></div><div class="gmail_extra"><br></div></div>