# How to get cmake to show a percentage progress report?

**URL:** <https://discourse.cmake.org/t/how-to-get-cmake-to-show-a-percentage-progress-report/6019>\
**Category:** Code\
**Tags:** os:windows\
**Created:** [July 7, 2022, 6:07am UTC](https://discourse.cmake.org/t/how-to-get-cmake-to-show-a-percentage-progress-report/6019 "2022-07-07T06:07:40Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![ddddxie](https://discourse.cmake.org/user_avatar/discourse.cmake.org/ddddxie/32/2581_2.png) [@ddddxie](https://discourse.cmake.org/u/ddddxie)\
**Post date:** [July 7, 2022, 6:07am UTC](https://discourse.cmake.org/t/how-to-get-cmake-to-show-a-percentage-progress-report/6019/1 "2022-07-07T06:07:40Z")

</div>

Hi,Experts  
I want to know how to get cmake to show a percentage progress report?  
like this  
[66%] Building CXX object utils/TableGen/CMakeFiles/obj.llvm-tblgen.dir/DFAEmitter.cpp.o  
[66%] Building CXX object utils/TableGen/CMakeFiles/obj.llvm-tblgen.dir/DFAPacketizerEmitter.cpp.o  
[66%] Building CXX object utils/TableGen/CMakeFiles/obj.llvm-tblgen.dir/DirectiveEmitter.cpp.o

```
Look forward reply!

```

Regards,  
Xie

---

<div class="post-metadata">

**Author:** ![fenrir](https://discourse.cmake.org/user_avatar/discourse.cmake.org/fenrir/32/734_2.png) [@fenrir](https://discourse.cmake.org/u/fenrir)\
**Post date:** [July 7, 2022, 6:14am UTC](https://discourse.cmake.org/t/how-to-get-cmake-to-show-a-percentage-progress-report/6019/2 "2022-07-07T06:14:53Z")

</div>

I don’t think CMake can do this.  
I believe during the processing CMake has no idea how much there’s left because of the things that can be included conditionally, so there is no way to report a meaningful progress.

---

<div class="post-metadata">

**Author:** ![ddddxie](https://discourse.cmake.org/user_avatar/discourse.cmake.org/ddddxie/32/2581_2.png) [@ddddxie](https://discourse.cmake.org/u/ddddxie)\
**Post date:** [July 7, 2022, 6:24am UTC](https://discourse.cmake.org/t/how-to-get-cmake-to-show-a-percentage-progress-report/6019/3 "2022-07-07T06:24:17Z")

</div>

I using Ninja as a generator, so can Ninja do this?  
And how did others do it?  
Thanks.

---

<div class="post-metadata">

**Author:** ![hsattler](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/h/59ef9b/32.png) [@hsattler](https://discourse.cmake.org/u/hsattler)\
**Post date:** [July 7, 2022, 6:43am UTC](https://discourse.cmake.org/t/how-to-get-cmake-to-show-a-percentage-progress-report/6019/4 "2022-07-07T06:43:17Z")

</div>

Last time I used Makefile generator, CMake pre-calculated this.

For ninja, you can configure NINJA\_STATUS environment variable.

---

<div class="post-metadata">

**Author:** ![ddddxie](https://discourse.cmake.org/user_avatar/discourse.cmake.org/ddddxie/32/2581_2.png) [@ddddxie](https://discourse.cmake.org/u/ddddxie)\
**Post date:** [July 7, 2022, 6:45am UTC](https://discourse.cmake.org/t/how-to-get-cmake-to-show-a-percentage-progress-report/6019/5 "2022-07-07T06:45:29Z")

</div>

How should I configure ninja env? Can you describe more detail?  
Thank you very much.

---

<div class="post-metadata">

**Author:** ![hsattler](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/h/59ef9b/32.png) [@hsattler](https://discourse.cmake.org/u/hsattler)\
**Post date:** [July 7, 2022, 7:29am UTC](https://discourse.cmake.org/t/how-to-get-cmake-to-show-a-percentage-progress-report/6019/6 "2022-07-07T07:29:44Z")

</div>

[https://ninja-build.org/manual.html#\_environment\_variables](https://ninja-build.org/manual.html#_environment_variables)

---

<div class="post-metadata">

**Author:** ![ddddxie](https://discourse.cmake.org/user_avatar/discourse.cmake.org/ddddxie/32/2581_2.png) [@ddddxie](https://discourse.cmake.org/u/ddddxie)\
**Post date:** [July 7, 2022, 7:36am UTC](https://discourse.cmake.org/t/how-to-get-cmake-to-show-a-percentage-progress-report/6019/7 "2022-07-07T07:36:52Z")

</div>

yes, I has found it, but it looks like dont work normally.  
I set NINJA\_STATUS in toolchain.cmake file like this set(ENV{NINJA\_STATUS} “[%p/%f/%t]”)  
please correct me if I am wrong on this.  
Thanks.

---

<div class="post-metadata">

**Author:** ![hsattler](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/h/59ef9b/32.png) [@hsattler](https://discourse.cmake.org/u/hsattler)\
**Post date:** [July 7, 2022, 8:20am UTC](https://discourse.cmake.org/t/how-to-get-cmake-to-show-a-percentage-progress-report/6019/8 "2022-07-07T08:20:49Z")

</div>

You set environment variables in your shell (the program that runs ninja). This is not CMake!

---

<div class="post-metadata">

**Author:** ![ddddxie](https://discourse.cmake.org/user_avatar/discourse.cmake.org/ddddxie/32/2581_2.png) [@ddddxie](https://discourse.cmake.org/u/ddddxie)\
**Post date:** [July 7, 2022, 8:34am UTC](https://discourse.cmake.org/t/how-to-get-cmake-to-show-a-percentage-progress-report/6019/9 "2022-07-07T08:34:49Z")

</div>

Get it, and it looks like work normally.  
Thank you very much.  
Regards,  
Xie

---

<div class="post-metadata">

**Author:** ![fenrir](https://discourse.cmake.org/user_avatar/discourse.cmake.org/fenrir/32/734_2.png) [@fenrir](https://discourse.cmake.org/u/fenrir)\
**Post date:** [July 7, 2022, 10:58am UTC](https://discourse.cmake.org/t/how-to-get-cmake-to-show-a-percentage-progress-report/6019/10 "2022-07-07T10:58:26Z")

</div>

Meh, I misunderstood the question. ☹

---

<div class="post-metadata">

**Author:** ![ddddxie](https://discourse.cmake.org/user_avatar/discourse.cmake.org/ddddxie/32/2581_2.png) [@ddddxie](https://discourse.cmake.org/u/ddddxie)\
**Post date:** [July 11, 2022, 6:20am UTC](https://discourse.cmake.org/t/how-to-get-cmake-to-show-a-percentage-progress-report/6019/11 "2022-07-11T06:20:56Z")

</div>

HH, Hendrik Sattler’s reply is right.
