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

Hello,

Is possible to determine whether the generation of the project build system 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), in a similar way to reading Python’s sys.argv

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.