Skip to content

CMake warning about deprecated policy related to RPATH #1721

@scfc

Description

@scfc

CMake 3.11.2 warns:

CMake Deprecation Warning at CMakeLists.txt:4 (cmake_policy):
  The OLD behavior for policy CMP0042 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.

The triggering code was added in commit ac5fd3a with the intention:

Set CMake policy CMP0042

to remove the warning below when running cmake.
In the long run changing the CMake rules to set MACOSX_RPATH
might be the better option.

  CMake Warning (dev):
    Policy CMP0042 is not set: MACOSX_RPATH is enabled by default.  Run "cmake
    --help-policy CMP0042" for policy details.  Use the cmake_policy
    command to set the policy and suppress this warning.
    MACOSX_RPATH is not specified for the following targets:

     libledger

  This warning is for project developers.  Use -Wno-dev to suppress it.

Policy CMP0042 is (AFAIUI) irrelevant to Linux where CMake 3.11.2 seems to do Almost The Right Thing™ by default (set RPATH for ledger to source directory when building and testing and to (for example) /usr/lib64 when installing; some/most distributions will want to clear that field when installing by setting CMAKE_SKIP_INSTALL_RPATH). So my instinct would be to remove the four lines from CMakeLists.txt and the one line from src/CMakeLists.txt that relate to RPATH.

But I do not know how this plays out under macOS. I assume the default there is reasonable as well, but I have no way of testing this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions