Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not build with CMake 4.0. #1352

Open
junhaoliao opened this issue Apr 1, 2025 · 10 comments
Open

Does not build with CMake 4.0. #1352

junhaoliao opened this issue Apr 1, 2025 · 10 comments

Comments

@junhaoliao
Copy link

The project now does not build with the latest version 4.0.0 of CMake

CMake Error at submodules/yaml-cpp/CMakeLists.txt:2 (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.

@junhaoliao
Copy link
Author

Changing the <MIN> bound from 3.4 to 3.5 resolved the issue:

# 3.5 is actually available almost everywhere, but this a good minimum.
# 3.14 as the upper policy limit avoids CMake deprecation warnings.
cmake_minimum_required(VERSION 3.4...3.14)

Maybe 3.5 is a better minimum now. :)

@mortbopet
Copy link

Just creating some noise here; CMake 4.0 is currently being deployed all over the place (e.g. packaged alongside other tools), and this deprecation is creating build errors for projects which directly or transitively depend on yaml-cpp. A version bump to at least 3.5 should occur ASAP. CC @jbeder.

@Blzut3
Copy link

Blzut3 commented Apr 2, 2025

@junhaoliao Are you building the release version and quoting the latest master source code? CMake 4.0 builds the latest master without error for me. The error description even specifically says what's on master is a recommended solution.

                                            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.

@pfeerick
Copy link

pfeerick commented Apr 3, 2025

The minimum version as referenced in #1352 (comment) is the current state of master branch. This PR is needed => #1351

@mnagaso
Copy link

mnagaso commented Apr 3, 2025

My project, which also using this library as a submodule, is hitting this problem while its build test with github actions:

 Submodule path 'yaml-cpp': checked out 'c73ee34704c512ebe915b283645aefa9f424a22f'
CMake Error at external_libs/yaml-cpp/CMakeLists.txt:2 (cmake_minimum_required):
  Compatibility with CMake < 3.5 has been removed from CMake.

So hoping the modification on this line should be done very soon.

@Blzut3
Copy link

Blzut3 commented Apr 3, 2025

@mnagaso the commit that fixed this was the very next commit after the 0.8 release tag: c268020 It looks like you're currently using some commit between 0.7 and 0.8. If you're not using the bundled Google Test (or building without tests) that commit should be enough to solve your issue.

@sidhant-microsoft
Copy link

sidhant-microsoft commented Apr 4, 2025

Hi do we have a target date for the fix?

@mnagaso
Copy link

mnagaso commented Apr 4, 2025

@Blzut3
Thank you for letting me know about the update! I will verify if I am using the latest one.

@mskripnik
Copy link

mskripnik commented Apr 4, 2025

We have the same issue. Azure updated their Ubuntu agent so it uses CMake 3.31 now, which complains about the cmake_minimum_required(VERSION 3.4...3.14)
line. We use yaml-cpp from conan center.

A patch release 0.8.1 with followin PR would fix the issue: #1351

@Blzut3
Copy link

Blzut3 commented Apr 4, 2025

@mskripnik Isn't the error pointing to the bundled gtest directory? I believe Conan sets BUILD_TESTING to ON by default. With testing off (or presumably using a system copy of gtest) yaml-cpp master should configure and build with CMake 4.0 no warnings or errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants