cmake --system-information ignores cross-compilation

I have been trying to use cmake on the command line with switch --system-information to dump system level information about a given configuration. In particular, I am interested in verifying that certain variables (e.g. CMAKE_SYSTEM_NAME) are set to the right values when cross-compiling against different targets. However, the information I get from --system-information ignores any cross-compilation settings and values set by toolchains.

The usage of --system-information is not very well documented, so I am a bit at loss exactly how it is supposed to be used. I have been trying it in various ways:

  1. Passing --system-information on the command line together with my other cmake flags, e.g.
    cmake … -G Ninja -DCMAKE_TOOLCHAIN_FILE= --system-information sysinfo.txt
  2. Generating my project first, the running cmake with --system-information, e.g.
    cmake … -G Ninja -DCMAKE_TOOLCHAIN_FILE=
    cmake -B . --system-information sysinfo.txt

I always only get host system information, never any target system information. I have tried it in Linux and on Windows. Am I doing it wrong or is --system-information not supposed to work the way I expect it to?

I think it always queries the host system.

Cc: @brad.king