Sections in variables manual have unclear meanings

The cmake-variables manual contains the following sections:

  • Variables that Provide Information
  • Variables that Change Behavior
  • Variables that Describe the System
  • Variables that Control the Build
  • Variables for Languages
  • Variables for CTest
  • Variables for CPack
  • Variable Expansion Operators
  • Internal Variables

I was looking at the first five and it can be difficult to know which section some variables belong in. There seems to be duplication, or at least considerable overlap. It also seems a bit arbitrary where some variables have ended up.

  • What is the difference between Variables that Provide Information and Variables that Describe the System? Conceptually, they are both providing information.
  • Are Variables that Provide Information expected to be read-only? If not, then that would imply they are meant for the user to provide information to CMake, but that would then overlap with Variables that Control the Build.
  • There are language-specific variables in the Variables that Provide Information section. Why are those not in the Variables for Languages section?

I’m sure there was a clear rationale for the separate groupings at one point, but I think now they are in need of a rethink. Can we come up with a simpler grouping system? I’d then recommend we add a brief paragraph at the start of each section which explains what that group covers so that it stays organised going forward.

PS: I got to this point after working on a feature that relates to CMAKE_TLS_VERIFY, CMAKE_TLS_CAINFO, CMAKE_NETRC and CMAKE_NETRC_FILE, only to find that the latter two were in a different section to the first one and I couldn’t come up with a justification for that. The docs for CMAKE_TLS_CAINFO appear to be missing altogether, but I’ll follow that up separately.

1 Like

I’m sure there was a clear rationale for the separate groupings at one point, but I think now they are in need of a rethink.

Yes.

I think “Variables that Provide Information” is meant for information about the project’s CMake layout/code. Many of the variables listed there as of CMake 3.21’s documentation belong to that category, but a few are wrong.

Meanwhile “Variables that Describe the System” is for variables about the host/target system and language-agnostic toolchain information.

I think moving all language specific variables into a dedicated section may make sense. They are only available/meaningful once enable_language(<LANG>) (or project()) has enabled the corresponding language.