<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from rtf -->
<style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
</head>
<body>
<font face="Arial, sans-serif" size="2">
<div>Hi</div>
<div>&nbsp;</div>
<div>I want to generate a source file &#8216;SourceFileInfo.cpp&#8217;, then build a library and then delete the generated file. </div>
<div><font face="Times New Roman, serif" size="2">&nbsp;</font></div>
<div>So I wrote:</div>
<div><font face="Times New Roman, serif" size="2">&nbsp;</font></div>
<div>&lt;snip&gt;</div>
<div><font face="Times New Roman, serif" size="2">&nbsp;</font></div>
<div>add_custom_command (</div>
<div>&nbsp; OUTPUT SourceFileInfo.cpp</div>
<div>&nbsp; COMMAND ../VersionInfo/_gnuRelease/versionInfo . KERNEL</div>
<div>&nbsp; DEPENDS ${SRCS}</div>
<div>&nbsp; COMMENT &quot;Generating SourceFileInfo.cpp&quot;</div>
<div>&nbsp; VERBATIM)</div>
<div>&nbsp;</div>
<div>list(APPEND SRCS SourceFileInfo.cpp)</div>
<div>&nbsp;</div>
<div>add_library( Kernel STATIC ${SRCS} )</div>
<div>&nbsp;</div>
<div>message(&quot;Removing file&quot;)</div>
<div>file( REMOVE SourceFileInfo.cpp )</div>
<div><font face="Times New Roman, serif" size="2">&nbsp;</font></div>
<div>But the message &#8216;Removing file&#8217; appears as the first action when executing make and the file remains after make has finished.  </div>
<div><font face="Times New Roman, serif" size="2">&nbsp;</font></div>
<div>I guess that one can&#8217;t interpret a CMakeLists.txt file sequentially, just like you can&#8217;t interpret a makefile sequentially.</div>
<div>&nbsp;</div>
<div>What am I doing wrong?</div>
<div>&nbsp;</div>
<div>Where can I find an explanation of CMake command ordering?</div>
<div style="margin-top: 5pt; margin-bottom: 5pt; ">Best regards </div>
<div style="margin-top: 5pt; margin-bottom: 5pt; ">David </div>
<div style="margin-top: 5pt; margin-bottom: 5pt; "><font face="Times New Roman, serif" size="2">&nbsp;</font></div>
</font>
</body>
</html>