Skip to content

CMake 4 on MacOS breaks compilation due to old compatibility requirement #1839

@titoiride

Description

@titoiride

With MacOS homebrew moving to CMake 4, now a few deprecations become errors. For instance, I can't compile anymore because of a cmake compatibility requirement imposed by the Json library.

CMake Error at build/_deps/openpmd-src/share/openPMD/thirdParty/json/CMakeLists.txt:1 (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.

I can work around it setting the environmental variable, as recommended, but I was wondering if it makes sense to either make Json optional, not sure if it's possible, or maybe find an internal workaround?
In my case, I will need to set this flag for my entire code for which openPMD is built internally via cmake as a dependency, so I will need to set the flag for a dependency of a dependency.
I was just bringing this up to understand if you just recommend that I manually work around this in my cmake, which is easy to do, or if you see a long-term solution.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions