Skip to content

CMake WRITE_BASIC_CONFIG_VERSION_FILE for CMake Versions < 3.0 #1786

@jwillikers

Description

@jwillikers

Using CMake 2.8.9, building GoogleTest fails because the PROJECT_VERSION variable is required by the write_basic_config_version_file command on line 96, but it is not set for CMake versions < 3.0 on line 44 of the CMakeLists.txt. Because the version cannot be set in the project command for versions of CMake less than 3, it is possible to fix this by supplying the version explicitly to the write_basic_config_version_file command. This is shown in the following line, which allowed my project to build successfully.

  write_basic_package_version_file(${version_file} VERSION ${GOOGLETEST_VERSION} COMPATIBILITY AnyNewerVersion)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions