Skip to content

CMake variable GOOGLETEST_VERSION is fixed, not computed from non-CMake-specific information #2124

@fidergo-stephane-gourichon

Description

Opening issue as approved by maintainer on #2089 .

Current state

CMake variable GOOGLETEST_VERSION is fixed, not computed from non-CMake-specific information, see line below:

set(GOOGLETEST_VERSION 1.9.0)

Consequence

As a consequence, whenever googletest version number changes, this file has to be changed, too.

This would be a non-issue if that line was the "single, unambiguous, authoritative representation".

The reality is googletest maintainers do not use CMake at all. CMake is completely community supported for googletest. bazel is main release mechanism.

If we do nothing about this, people building using CMake will get wrong version information as soon as version changes, until someone fixes that each time.

Solution

It is possible in CMake to automatically compute the value of the variable, based on git describe.
For example, this answer: https://stackoverflow.com/a/38836941

Best solutions are those that keep maximum portability (avoid making unnecessary assumptions about CMake-time platform).

As a side note, it would be best to add some comments on top of the CMakeLists.txt to make clear that bazel is primary build system and CMake is community supported.

I may do this some time in the future, but don't hold your breath. Anyone can offer a PR, too.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions