Skip to content

tidy-html5 fails to build with CMake 4.0 #1139

Open
@renodr

Description

@renodr

CMake 4.0 was released on March 28th, and is a lot more strict than previous versions. Because of the changes, it has broken the build process of tidy. A lot of things that were previously warnings are now no longer allowed.

When trying to build this package with CMake 4.0, the first error that you'll see is:

CMake Error at CMakeLists.txt:20 (cmake_minimum_required):
  Compatibility with CMake < 3.5 has been removed from CMake.

  Update the VERSION argument <min> value.  Or, use the <min>...<max> syntax
  to tell CMake that the project requires at least <min> but has been updated
  to work with policies introduced by <max> or earlier.

  Or, add -DCMAKE_POLICY_VERSION_MINIMUM=3.5 to try configuring anyway.


-- Configuring incomplete, errors occurred!

To fix this, I changed Line 20 of CMakeLists.txt to read "cmake_minimum_required (VERSION 2.8.12...4.0)"

After this though, it still failed to build:

-- Detecting CXX compile features - done
-> TIDY_SO_VERSION = 58. This is an EVEN (stable) release.
-- *** Debug Logging is NOT enabled.
-- *** Building support for runtime configuration files.
-- *** Also building DLL library SHARED, version 5.8.0, date 2021.07.10
-- *** Generating man tidy.1 custom commands...
CMake Error at CMakeLists.txt:530 (add_custom_command):
  Exactly one of PRE_BUILD, PRE_LINK, or POST_BUILD must be given.


CMake Error at CMakeLists.txt:538 (add_custom_command):
  Exactly one of PRE_BUILD, PRE_LINK, or POST_BUILD must be given.


CMake Error at CMakeLists.txt:546 (add_custom_command):
  The following keywords are not supported when using
  add_custom_command(TARGET): DEPENDS


-- Configuring incomplete, errors occurred!

I've fixed this locally and will send in a PR shortly. I can confirm that my patch works with CMake 4.0 and CMake 3.30.x.

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