[CMake] Bug? A failure in add_custom_command/POST_BUILD does not propagate to target.

Hugo Heden hugoheden at gmail.com
Mon Apr 20 05:50:13 EDT 2009


On Fri, Apr 17, 2009 at 10:19 PM, Alexander Neundorf <
a.neundorf-work at gmx.net> wrote:

> On Friday 17 April 2009, Hugo Heden wrote:
> > The following example illustrates a possible bug.
> >
> > 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).
> >
> > ===========================
> > cmake_minimum_required(VERSION 2.6)
> >
> > PROJECT( test )
> >
> > ADD_CUSTOM_TARGET( MyTarget
> >   COMMENT "This is MyTarget"
> > )
> >
> > ADD_CUSTOM_COMMAND(
> >     TARGET MyTarget
> >     POST_BUILD
> >     COMMAND cmake -E blablablahh # Error (intentional error, to
> illustrate
> > buggy behaviour.)
> >     VERBATIM
> >     )
> >
> > ADD_CUSTOM_COMMAND(
> >    TARGET MyTarget
> >    POST_BUILD
> >    COMMAND cmake -E echo "hello there" # Success.
> >    VERBATIM
> > )
> > =============================
> >
> > However, running
> >
> >   > cmake -G "Visual Studio 9 2008" ..\source
> >   > devenv test.sln /Build Debug /Project MyTarget.vcproj
> >
> > succeeds, which is not expected. (Right?).
> >
> > 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.
> >
> >   > cmake --version
> >
> >   cmake version 2.6-patch 2
> >
> > Any comments?
>
> Please report this as a bug in the bug tracker.
>

Done, see http://public.kitware.com/Bug/view.php?id=8906

/Hugo Heden
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090420/af254022/attachment.htm>


More information about the CMake mailing list