Make generator: Enter and Leave directory message

Hello,

Using the current CMake master on linux, I have noticed a lot of

make[2]: Entering directory '...'
make[2]: Leaving directory '...'

in the make output. These message are usual when using make but where hidden by cmake previously if I remember correctly.
Is this change intentional ? Is there a way to hide these messages ?

PS: I launch the build using cmake --build .

--no-print-directory hides these. I’m not seeing it locally here with GNU Make 4.2.1.

I observed the same. I think this is caused by a bug in Make 4.3 (I’d venture a guess that this is what you are using?). It appears to ignore the “.SILENT” directive in makefiles, which CMake is using to suppress this output. I can get rid of these messages by downgrading make to 4.2.1, or by invoking make manually with “make -s”

1 Like

Has a bug been filed upstream about this?

Yes, I filed:

https://savannah.gnu.org/bugs/?58013

1 Like

Thanks. I’ve added myself to the CC list.

Seems to be intentional (https://savannah.gnu.org/bugs/?54740). I’ve filed a CMake issue.

The GNU make fix that was made that changes this behavior was indeed intentional and is needed for correct and conforming operation. It ends up that .SILENT causing the Enter/Leave messages to be quieted was an unexpected side-effect of that incorrect behavior: certainly it’s not documented that way.

Unfortunately it’s not really feasible to get that behavior back because it would involve somehow detecting the .SILENT: target in the makefile before printing any output, so that make knows whether or not to generate the Entering/Leaving message (which must be printed before any other output/after all other output).

There are portable ways to do this but it will require changes in the makefiles that cmake generates.

For the short term, users can add export GNUMAKEFLAGS=--no-print-directory to their shell configuration to avoid this message being printed, without forcing the -s option. By adding this to GNUMAKEFLAGS it won’t impact other versions of make, if you happen to be using them.