1

Suppose I have hundreds of targets and some of them are not critical for the build to succeed (and for example I am using --keep-going on make or -k 9000 on ninja) and I need to figure out which cmake targets failed.

With add_custom_command() a post-build command can be added to a cmake target that prints its name like this:

success: myTarget.dll

But what about failures?

If linking fails then I can parse the verbose output of whatever I am using (ninja/make/msbuild) and see which target has failed.

However if compilation of a translation unit fails the only error I get is that a particular source file does not compile and figuring out which cmake target exactly has failed is harder.

The only thing I have come up with is running this after the build has failed: ninja -nv which will make a verbose dry run and I can intercept the link commands and parse the cmake targets that have failed that way...

Any other ideas?

onqtam
  • 4,356
  • 2
  • 28
  • 50
  • You may want to take a look at my answer for [Save and reprint warnings for successfully-compiled files on subsequent builds?](http://stackoverflow.com/questions/31348508/save-and-reprint-warnings-for-successfully-compiled-files-on-subsequent-builds/31710461#31710461). I think you could achieve what you want by giving a build script with [RULE_LAUNCH_COMPILE](https://cmake.org/cmake/help/v3.4/prop_gbl/RULE_LAUNCH_COMPILE.html) and capture `stderr` outputs. – Florian Nov 15 '15 at 19:54

1 Answers1

0

I ended up using dry runs of make/ninja and parsing their output

onqtam
  • 4,356
  • 2
  • 28
  • 50