arsenm / sanitizers-cmake

CMake modules to help use sanitizers
Other
377 stars 65 forks source link

Set CMP0051 to new. #7

Closed alehaa closed 7 years ago

alehaa commented 8 years ago

To avoid error messages about CMP0051, this policy will be set to new.

This will throw a warning about CMP0011, but this has to be set only once for the whole project:

 CMake Warning (dev) in externals/CMake-sanitizers/cmake/FindSanitizers.cmake:
  Policy CMP0011 is not set: Included scripts do automatic cmake_policy PUSH
  and POP.  Run "cmake --help-policy CMP0011" for policy details.  Use the
  cmake_policy command to set the policy and suppress this warning.

  The included script

   [...]/externals/CMake-sanitizers/cmake/FindSanitizers.cmake

  affects policy settings.  CMake is implying the NO_POLICY_SCOPE option for
  compatibility, so the effects are applied to the including context.
Call Stack (most recent call first):
  [...]
This warning is for project developers.  Use -Wno-dev to suppress it.
alehaa commented 7 years ago

As far as I understand the CMake policy CMP0051, the warning will be printed, because FindSanitizers.cmake scans for a target with generator expressions in the sources.

As this is no issue of this CMake module, but the including project, this project should set the policy instead of this CMake module. There should be no additional overhead, as either CMP0051 or for this patch CMP0011 must be set, so I'll close this patch now.