ExternalProject: Ninja doesn't show progress

My CMake projects frequently build large subprojects with ExternalProject (EP). When using Ninja, during the overall project build, ExternalProject doesn’t print any text until each EP step completes.

For example, if the “download” EP step takes a while, no progress is printed until the step is complete. This is true for every EP step “configure”, “build” etc. This is onerous to users, since sometimes it’s 30+ minutes to build the EP and they don’t know what’s happening.

Example CMakeLists.txt

cmake_minimum_required(VERSION 3.21...3.27)

project(CMakeBuilder LANGUAGES C CXX)

include(ExternalProject)

set(CMAKE_TLS_VERIFY true)

message(STATUS "CMake ${CMAKE_VERSION} CMAKE_GENERATOR ${CMAKE_GENERATOR}")

ExternalProject_Add(CMAKE
GIT_REPOSITORY https://gitlab.kitware.com/cmake/cmake.git
GIT_SHALLOW true
GIT_PROGRESS true
)

In No verbose output when building an external project with ninja @ben.boeckel mentions “CMAKE_VERBOSE_BUILD”. Setting this variable =1 didn’t help, nor did “VERBOSE=1”

My current workaround is to tell users to specify cmake -G "Unix Makefiles" but given enough users, they forget and then think the project is broken because the build is silent for 10s of minutes if using Ninja while building ExternalProject.

You can tell projects USES_TERMINAL 1, but this will make all such ExternalProject steps serialize against each other.

1 Like

To fill out Ben’s suggestion that works to print progress of ExternalProject with Ninja generator using Terminal Access options

ExternalProject_Add(CMAKE
GIT_REPOSITORY https://gitlab.kitware.com/cmake/cmake.git
GIT_SHALLOW true
GIT_PROGRESS true
USES_TERMINAL_DOWNLOAD true
USES_TERMINAL_UPDATE true
USES_TERMINAL_BUILD true
USES_TERMINAL_INSTALL true
USES_TERMINAL_TEST true
)