Skip to content

Investigate deprecated CMake policies #488

@devreal

Description

@devreal

I just built DASH using CMake 3.9 and saw a bunch warnings due to enforced OLD policies:

CMake Deprecation Warning at CMakeLists.txt:12 (cmake_policy):
  The OLD behavior for policy CMP0007 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.


CMake Deprecation Warning at CMakeLists.txt:15 (cmake_policy):
  The OLD behavior for policy CMP0003 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.


CMake Deprecation Warning at CMakeLists.txt:21 (cmake_policy):
  The OLD behavior for policy CMP0004 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.


CMake Deprecation Warning at CMakeLists.txt:24 (cmake_policy):
  The OLD behavior for policy CMP0016 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.
  1. CMP0007: OLD suppresses counting empty list elements (see https://cmake.org/cmake/help/v3.6/policy/CMP0007.html)
  2. CMP0003: OLD splits absolute paths passed to target_link_libraries into -L and -l parts instead of passing the absolute path (see http://docs.w3cub.com/cmake~3.9/policy/cmp0003/)
  3. CMP0004: OLD silently removes whitespaces in target_link_libraries(myexe " A "), NEW causes white spaces to be erroneous (see http://docs.w3cub.com/cmake~3.9/policy/cmp0004/)
  4. CMP0016: NEW causes an error if the first argument to target_link_libraries() is not a target (see http://docs.w3cub.com/cmake~3.9/policy/cmp0016/)

Now, unsurprisingly none of these choices are documented and hence I have no idea whether they are still required. I suggest we remove these policy settings and fix our CMake files to comply with the new behavior.

We also set policies CMP0054 (expansion in if()), CMP0053 (variable references), CMP0060 (implicit link directories), and CMP0058 (byproducts for ninja builds) which do not currently trigger a warning. It might be worth looking at them as well (except for CMP0058 I guess).

Metadata

Metadata

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions