<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> </div>
<div>I want to generate a source file ‘SourceFileInfo.cpp’, then build a library and then delete the generated file. </div>
<div><font face="Times New Roman, serif" size="2"> </font></div>
<div>So I wrote:</div>
<div><font face="Times New Roman, serif" size="2"> </font></div>
<div><snip></div>
<div><font face="Times New Roman, serif" size="2"> </font></div>
<div>add_custom_command (</div>
<div> OUTPUT SourceFileInfo.cpp</div>
<div> COMMAND ../VersionInfo/_gnuRelease/versionInfo . KERNEL</div>
<div> DEPENDS ${SRCS}</div>
<div> COMMENT "Generating SourceFileInfo.cpp"</div>
<div> VERBATIM)</div>
<div> </div>
<div>list(APPEND SRCS SourceFileInfo.cpp)</div>
<div> </div>
<div>add_library( Kernel STATIC ${SRCS} )</div>
<div> </div>
<div>message("Removing file")</div>
<div>file( REMOVE SourceFileInfo.cpp )</div>
<div><font face="Times New Roman, serif" size="2"> </font></div>
<div>But the message ‘Removing file’ 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"> </font></div>
<div>I guess that one can’t interpret a CMakeLists.txt file sequentially, just like you can’t interpret a makefile sequentially.</div>
<div> </div>
<div>What am I doing wrong?</div>
<div> </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"> </font></div>
</font>
</body>
</html>