Skip to content

CMake 4: CMP0004 OLD not supported any longer #393

@0-wiz-0

Description

@0-wiz-0

When updating CMake to version 4.1.0 in pkgsrc, I noticed that this breaks the build of milkytacker (1.04.00, but the line is still there in today's git head):

CMake Error at CMakeLists.txt:172 (cmake_policy):
  Policy CMP0004 may not be set to OLD behavior because this version of CMake
  no longer supports it.  The policy was introduced in CMake version 2.6.0,
  and use of NEW behavior is now required.

  Please either update your CMakeLists.txt files to conform to the new
  behavior or use an older version of CMake that still supports the old
  behavior.  Run cmake --help-policy CMP0004 for more information.

After removing the offending line, the build succeeds in my build environment:

--- CMakeLists.txt.orig 2023-07-05 08:03:59.000000000 +0000
+++ CMakeLists.txt
@@ -169,7 +169,6 @@ elseif(WIN32)
 else()
     # Workaround for SDL bug #3295, which occurs in SDL2 <2.0.5
     # https://bugzilla.libsdl.org/show_bug.cgi?id=3295
-    cmake_policy(SET CMP0004 OLD)

     find_package(SDL2 REQUIRED)
 endif()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions