Xudong
Xudong

Reputation: 141

How to make the cmake-generated makefile stop at the first error

I use cmake to manage the build process of my project. Everytime when I want to rebuild it, what I need to do is simply cmake .. & make -j8, It works very well.

But I noticed that, the make command usually would like to output lots of errors then stopped finnaly.

It is a little annoying: Because for most of cases the first error is important and are essentialy the origin of your other errors.

How can I make cmake-generated makefile stop at the first error instead of continuing doing other stuffs?

Any suggestion is appreciated.


Update 1: Under @Kitsu 's help can I realize the main duty is in make -j8. If I use make -j1 instead, the make will stop at the first error.

But if we compile a big project, -j8 usually makes sense... Is here any other way that can tell the fullset of make threads realize that, here is an error and stop themselves all at once?:)

Upvotes: 5

Views: 3791

Answers (1)

Kitsu
Kitsu

Reputation: 3445

-Wfatal-errors flag might do the thing for gcc. Also you may try to reduce parallelism for make itself (e.g. make -j1).

Upvotes: 3

Related Questions