[cmake-developers] Fragile behaviour of msbuild when using Visual Studio solution/project generators

rleigh at codelibre.net rleigh at codelibre.net
Thu Oct 22 10:58:29 EDT 2015


I encountered an unexpected build failure in a superbuild project today,
and after investigation with the help of ngladitz on #cmake, we got to the
bottom of the problem.

http://blogs.msdn.com/b/dsvc/archive/2012/02/29/output-from-exec-task-resulting-in-build-failure.aspx

When cmake runs an external command in the build, if that command outputs
to stdout the strings "Error:" or "error:" this will *fail the build*
irrespective of the exit status of that command (!).  Looks like a
horrible design flaw in msbuild, but the implication is that this makes
the build quite fragile since any output at all, including test output,
output from custom tools and scripts etc., can all cause a build failure.

Examples:

http://pastebin.ca/3211683 - build failure due to "Error:" and "error:"
http://pastebin.ca/3211759 - build success with the output adjusted to
remove these strings
In both these cases, the tests all pass and ctest returns a zero exit status.

The msbuild <Exec> task can use IgnoreStandardErrorWarningFormat="true" to
suppress this behaviour.  It would probably be appropriate to enable this
for all uses other than maybe compiling and linking.  We seem to use
<CustomBuild>'s <Command> rather than <Exec>; if the flag works for both
elements that would be great, but I'm afraid I'm not an expert in the
internals of msbuild and I couldn't find any obvious documentation for
<CustomBuild>.  If this could be made to ignore what's on stdout/err when
running unit tests and other non-build/link tasks that would be really
great.


Regards,
Roger



More information about the cmake-developers mailing list