Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMP0048 policy warning if used in a project, that uses this policy. #47

Closed
jxsl13 opened this issue Aug 17, 2019 · 1 comment
Closed

Comments

@jxsl13
Copy link

jxsl13 commented Aug 17, 2019

cpp-redis & tacopie issue

I'm using this library in a project, that uses CMP0048 NEW policy and getting warnings regarding that:

CMake Error (dev) at src/engine/external/cpp_redis/CMakeLists.txt:41 (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
    PROJECT_VERSION_TWEAK
This error is for project developers. Use -Wno-error=dev to suppress it.

CMake Error (dev) at src/engine/external/cpp_redis/tacopie/CMakeLists.txt:41 (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
    PROJECT_VERSION_TWEAK
This error is for project developers. Use -Wno-error=dev to suppress it.

I'm building my project with AppVeyor and it's explicitly handling warnings as errors and turning that off seems to be a bad option security-wise.

A litte bit of googling told me that this might help?
Tencent/rapidjson#1154 (comment)

if (POLICY CMP0048)
  cmake_policy(SET CMP0048 OLD)
endif()

Edit:
SRombauts/SQLiteCpp#184 (comment)

It seems to be a bad idea to use POLICY OLD, as it will be deprecated in the future.
Setting a proper version number seems to be the correct way to solve this.

@lindblandro
Copy link

IMO the whole CMakeLists.txt should be rewritten for newer CMake versions to better support inclusion in other projects. I forked this (and tacopie, which basically duplicates all build files) since I'd like to use this as a submodule. The whole branch is currnetly probably too large for a single merge, cmake_minimum_required() is currently based on what I had on hand, and I didn't have the time to test any Windows builds. Tried an arm cross compile on Yocto and everything went smoothly, though.

I'd like to know if there actually are developers who are forced to use CMake < 3, but still wish to use cpp_redis.

@jxsl13 jxsl13 closed this as completed Jul 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants