mirror of
https://gitlab.kitware.com/cmake/cmake.git
synced 2026-09-25 04:09:36 +03:00
A parallel `cmake --build` with a Makefiles generator interleaved the output of concurrent recipes. When CMake is the one passing the parallel flag and a build-time probe finds GNU Make 4.0 or newer, append `-Otarget` so each recipe's output stays grouped. A native `-- -j` leaves the job count unset and opts out. Honor `USES_TERMINAL` under grouping by prefixing such recipes with a `$(CMAKE_USES_TERMINAL_PREFIX)` variable, empty by default and set to `+` next to `-Otarget`, so interactive commands stay unbuffered. Fixes: #27510
21 lines
622 B
CMake
21 lines
622 B
CMake
# Recipe that wants interactive terminal access: prefixed with the toggle.
|
|
add_custom_target(term ALL
|
|
COMMAND $(CMAKE_COMMAND) -E true
|
|
USES_TERMINAL)
|
|
|
|
# Ordinary recipe: no prefix at all.
|
|
add_custom_target(plain ALL
|
|
COMMAND $(CMAKE_COMMAND) -E true)
|
|
|
|
# Jobserver-aware recipe: keeps the literal '+' prefix.
|
|
add_custom_target(jsa ALL
|
|
COMMAND $(CMAKE_COMMAND) -E true
|
|
JOB_SERVER_AWARE ON)
|
|
|
|
# Both jobserver-aware and interactive: the '+' branch wins, so the toggle
|
|
# prefix must not be added (no doubled prefix).
|
|
add_custom_target(both ALL
|
|
COMMAND $(CMAKE_COMMAND) -E true
|
|
USES_TERMINAL
|
|
JOB_SERVER_AWARE ON)
|