10

Is there some way to show download progress while downloading git repository using FetchContent?

I tried to clear FETCHCONTENT_QUIET, but it did nothing. I have no idea if it is even possible.

Kevin
  • 16,549
  • 8
  • 60
  • 74
Etwus
  • 549
  • 5
  • 15
  • Can you please specify what platform/generator you are using? – Kevin Feb 28 '20 at 18:30
  • I am using Windows/ninja, could it be dependent on platform? – Etwus Feb 28 '20 at 18:40
  • 1
    It may be dependent on platform, but I know it's dependent on your generator. For Ninja, you need to set `USES_TERMINAL_DOWNLOAD` to `TRUE` in your call to `FetchContent_Declare()`. – Kevin Feb 28 '20 at 18:43
  • 1
    Also, see CMake maintainer Craig Scott's explanation on this CMake [issues](https://gitlab.kitware.com/cmake/cmake/issues/18238#note_440475) page. – Kevin Feb 28 '20 at 19:32

2 Answers2

16

Clarification: To see git clone progress, you need to set both FetchContent_Quiet and GIT_PROGRESS as in the below example

Set(FETCHCONTENT_QUIET FALSE)

FetchContent_Declare(
  someTarget
  GIT_REPOSITORY "https://github.com/someone/someTarget.git"
  GIT_TAG "tag"
  GIT_PROGRESS TRUE
)
Chris_128
  • 347
  • 5
  • 10
4

I just figured out that I have to use GIT_PROGRESS <bool> in FetchContent_Declare.

FetchContent_Declare(
  someTarget
  GIT_REPOSITORY "https://github.com/someone/someTarget.git"
  GIT_TAG "tag"
  GIT_PROGRESS TRUE
)
Kevin
  • 16,549
  • 8
  • 60
  • 74
Etwus
  • 549
  • 5
  • 15