Skip to content

Conversation

@mbrobbel
Copy link
Contributor

As suggested in #2150.

This moves the cmake_policy command before the project definition, where it used to be until: 67265e0. It was introduced with #782.

This suppresses the following policy warning:

CMake Warning (dev) at CMakeLists.txt:6 (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:

    CMAKE_PROJECT_VERSION
    CMAKE_PROJECT_VERSION_MAJOR
    CMAKE_PROJECT_VERSION_MINOR
    CMAKE_PROJECT_VERSION_PATCH
This warning is for project developers.  Use -Wno-dev to suppress it.

@gennadiycivil
Copy link
Contributor

@mbrobbel thank you for this. Just to note CMake support is community-based. The maintainers do not use CMake internally.
With that, what is the before/after effect this would create and how is this beneficial? Basically if you could provide before and after logs to show the difference.

@mbrobbel
Copy link
Contributor Author

Building this project with CMake before the patch:

CMake Warning (dev) at CMakeLists.txt:6 (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:

    CMAKE_PROJECT_VERSION
    CMAKE_PROJECT_VERSION_MAJOR
    CMAKE_PROJECT_VERSION_MINOR
    CMAKE_PROJECT_VERSION_PATCH
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Configuring done
-- Generating done
-- Build files have been written to: /code/googletest/build

After applying this patch the warning is suppressed:

-- Configuring done
-- Generating done
-- Build files have been written to: /code/googletest/build

It was reported first in #709, and fixed with #782. 67265e0 resulted in the warning showing again, because, as mentioned in #2150 the cmake_policy command should come before the project command.

@gennadiycivil gennadiycivil merged commit 97d8c47 into google:master May 30, 2019
gennadiycivil added a commit that referenced this pull request May 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants