# difference between Xxx\_VERSION\_Yy and Xxx\_VERSION\_MAJOR

**URL:** https://discourse.cmake.org/t/difference-between-xxx-version-yy-and-xxx-version-major/2430
**Category:** Usage
**Created:** [December 27, 2020, 1:27am UTC](https://discourse.cmake.org/t/difference-between-xxx-version-yy-and-xxx-version-major/2430 "2020-12-27T01:27:50Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![hex](https://discourse.cmake.org/user_avatar/discourse.cmake.org/hex/32/363_2.png) [@hex](https://discourse.cmake.org/u/hex)
#### Post date: [December 27, 2020, 1:27am UTC](https://discourse.cmake.org/t/difference-between-xxx-version-yy-and-xxx-version-major/2430/1 "2020-12-27T01:27:50Z")

</div>

the [documentation about CMake modules](https://cmake.org/cmake/help/latest/manual/cmake-developer.7.html#standard-variable-names) 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?

---

<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: [January 4, 2021, 6:58pm UTC](https://discourse.cmake.org/t/difference-between-xxx-version-yy-and-xxx-version-major/2430/2 "2021-01-04T18:58:29Z")

</div>

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

---

<div class="post-metadata">

### Author: ![craig.scott](https://discourse.cmake.org/user_avatar/discourse.cmake.org/craig.scott/32/20_2.png) [@craig.scott](https://discourse.cmake.org/u/craig.scott)
#### Post date: [January 5, 2021, 2:06am UTC](https://discourse.cmake.org/t/difference-between-xxx-version-yy-and-xxx-version-major/2430/3 "2021-01-05T02:06:59Z")

</div>

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. 😉

---

<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: [January 5, 2021, 1:42pm UTC](https://discourse.cmake.org/t/difference-between-xxx-version-yy-and-xxx-version-major/2430/4 "2021-01-05T13:42:20Z")

</div>

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).
