Browse Source

ExternalProject: Silence step succeeded message when using Ninja

When doing an ExternalProject superbuild with all output logged to
files, the output currently looks as follows:

```
[652/904] Performing install step for 'plasma-framework'
-- plasma-framework install command succeeded.  See also /root/build/kde/frameworks/plasma-framework/log/plasma-framework-install-*.log
[658/904] Performing build step for 'khtml'
-- khtml build command succeeded.  See also /root/build/kde/frameworks/khtml/log/khtml-build-*.log
[659/904] Performing install step for 'khtml'
-- khtml install command succeeded.  See also /root/build/kde/frameworks/khtml/log/khtml-install-*.log
[661/904] Performing configure step for 'krunner'
-- krunner configure command succeeded.  See also /root/build/kde/frameworks/krunner/log/krunner-configure-*.log
[661/904] Performing build step for 'krunner'
```

More specifically, because a success line is printed for every
succeeded step, we lose the advantage of Ninja's progress bar
which will now also print a new line instead of updating the same
link as happens when using Ninja in a normal CMake project.

By silencing the success message when using the Ninja generator,
Ninja's progress bar works as expected and updates inline instead
of printing a new line for each progress update.

With this change, the above output is reduced to a single line
progress bar:

```
[661/904] Performing build step for 'krunner'
```
Daan De Meyer 5 years ago
parent
commit
850de767e9
1 changed files with 4 additions and 2 deletions
  1. 4 2
      Modules/ExternalProject.cmake

+ 4 - 2
Modules/ExternalProject.cmake

@@ -2064,8 +2064,10 @@ if(result)
     message(FATAL_ERROR \"\${msg}\")
   endif()
 else()
-  set(msg \"${name} ${step} command succeeded.  See also ${logbase}-*.log\")
-  message(STATUS \"\${msg}\")
+  if(NOT \"${CMAKE_GENERATOR}\" MATCHES \"Ninja\")
+    set(msg \"${name} ${step} command succeeded.  See also ${logbase}-*.log\")
+    message(STATUS \"\${msg}\")
+  endif()
 endif()
 ")
   file(GENERATE OUTPUT "${script}" CONTENT "${code}")