Skip to content

CMake policy warning about PROJECT_VERSION #709

@KingDuckZ

Description

@KingDuckZ

When compiling gtest master as a subproject I get a bunch of warnings like this:

CMake Warning (dev) at test/gtest/CMakeLists.txt:3 (project):
  Policy CMP0048 is not set: project() command manages VERSION variables.
  Run "cmake --help-policy CMP0048" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  The following variable(s) would be set to empty:

    PROJECT_VERSION
    PROJECT_VERSION_MAJOR
    PROJECT_VERSION_MINOR
    PROJECT_VERSION_PATCH
This warning is for project developers.  Use -Wno-dev to suppress it.

I don't get this warning if I build gtest 1.7.0, likely because it incorrectly calls cmake_minimum_required() after project(). That's incorrect but it happens to be better in my specific case. However, I think the proper fix would be adding cmake_policy(SET CMP0048 NEW) to your cmake files. The warning is about PROJECT_VERSION and related variables getting unset automatically, but I don't think you're using any such variable so it shouldn't make any difference.

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