difference between Xxx_VERSION_Yy and Xxx_VERSION_MAJOR

the documentation about CMake modules lists both Xxx_VERSION_Yy and Xxx_VERSION_MAJOR et all as recommended variables:

  • Xxx_VERSION_Yy: Expect Version Yy if true. Make sure at most one of these is ever true
  • Xxx_VERSION_MAJOR: The major version of the package found, if any

is there any meaning in this separation? Should i read this as major being a subset of Xy which holds a special meaning for CMake? Or have these sets different use cases?

i.e., can i phrase this as:

define Xxx_VERSION_Yy to provide version details, of which Xxx_VERSION_MAJOR should be used for major versions.

i think i’ve read in the documentation that version handling is left to the package developer but I couldn’t locate the source. In this case using Xxx_VERSION_MAJOR for major versions is only a recommendation?

This is probably some vestigal wording that could use a cleanup. I’m not sure what the state-of-the-art is with these variables.

Cc: @craig.scott @kyle.edwards @betsy.mcphail

I don’t know the history either. Regarding “state-of-the-art”, that would be don’t use the variables at all and use imported targets instead. :wink:

I’m agreed on imported targets for most things, but for various bits that cannot be done using targets, some kind of variable is needed (e.g., giving the actual version that was found back).