The following example illustrates a possible bug. <br><br>Consider the following CMakeLists.txt code. This little "project" should fail when the target MyTarget is built (because one of the POST_BUILD custom commands fails).<br>
<br><span style="font-family: courier new,monospace;">===========================</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">cmake_minimum_required(VERSION 2.6)</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">PROJECT( test )</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">ADD_CUSTOM_TARGET( MyTarget</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> COMMENT "This is MyTarget"</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">)</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">ADD_CUSTOM_COMMAND(</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> TARGET MyTarget</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> POST_BUILD</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> COMMAND cmake -E blablablahh # Error (intentional error, to illustrate buggy behaviour.)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> VERBATIM</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> )</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">ADD_CUSTOM_COMMAND(</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> TARGET MyTarget</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> POST_BUILD</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> COMMAND cmake -E echo "hello there" # Success.</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> VERBATIM</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">=============================</span><br style="font-family: courier new,monospace;">
<br>However, running<br><br><span style="font-family: courier new,monospace;"> > cmake -G "Visual Studio 9 2008" ..\source</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
> devenv test.sln /Build Debug /Project MyTarget.vcproj</span><br style="font-family: courier new,monospace;">
<br>succeeds, which is not expected. (Right?). <br><br>The problem seems to be that a succeeding custom command comes after the failing one, and this sort of *hides* the failure somehow.. The fact that failures are hidden like this is of course dangerous. (We have tests that have been failing like this for a while that have not shown up as error in our nightly builds.) When using other Generators and build tools (I have tested with "NMake Makefiles" -- nmake on Windows and "Unix Makefiles" -- Gnu-make on Linux) the build phase fails as expected.<br>
<br><span style="font-family: courier new,monospace;"> > cmake --version </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> cmake version 2.6-patch 2</span><br style="font-family: courier new,monospace;">
<br>Any comments? <br><br>Thanks<br><br>Hugo Heden<br>Swedish Defence Research Agency<br>Stockholm, Sweden<br><br><br><br>