# How to determine whether the generation of the project build system is being run in trace mode?

**URL:** <https://discourse.cmake.org/t/how-to-determine-whether-the-generation-of-the-project-build-system-is-being-run-in-trace-mode/2100>\
**Category:** Code\
**Created:** [October 31, 2020, 6:50am UTC](https://discourse.cmake.org/t/how-to-determine-whether-the-generation-of-the-project-build-system-is-being-run-in-trace-mode/2100 "2020-10-31T06:50:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shane\_Dev](https://discourse.cmake.org/user_avatar/discourse.cmake.org/shane_dev/32/841_2.png) [@Shane\_Dev](https://discourse.cmake.org/u/Shane_Dev)\
**Post date:** [October 31, 2020, 6:50am UTC](https://discourse.cmake.org/t/how-to-determine-whether-the-generation-of-the-project-build-system-is-being-run-in-trace-mode/2100/1 "2020-10-31T06:50:48Z")

</div>

Hello,

Is possible to determine whether the [generation of the project build system](https://cmake.org/cmake/help/latest/manual/cmake.1.html#generate-a-project-buildsystem) is being run in trace mode (from within the called script)?

For example, can the script determine which command line options were passed to [cmake(1)](https://cmake.org/cmake/help/latest/manual/cmake.1.html#options), in a similar way to reading Python’s `sys.argv`

---

<div class="post-metadata">

**Author:** ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)\
**Post date:** [November 25, 2020, 4:35pm UTC](https://discourse.cmake.org/t/how-to-determine-whether-the-generation-of-the-project-build-system-is-being-run-in-trace-mode/2100/2 "2020-11-25T16:35:26Z")

</div>

I don’t believe that there is any in-code way of detecting whether tracing is enabled. I think this is good since code can’t then change its behavior when being traced.

As for arguments on the command line being available, I think that is only done in script mode, but it probably excludes any flags that CMake itself consumed. Actually, it appears that `--` is required to trigger it. It sets `CMAKE_ARGV<N>` variables for use in the script in this case.
