Skip to content

Use a range for CMake minimum versions, 3.2...3.12: support CMake 4.0 #121

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

musicinmybrain
Copy link
Contributor

@musicinmybrain musicinmybrain commented Mar 6, 2025

CMake 4.0 drops support for CMake <3.5, so minimum versions need to be adjusted for forward compatibility. As long as we are touching the minimum version, let’s advance to 3.12, which can be considered the oldest “modern” CMake release, and which is available in all known supported Linux distributions today.

@mrgreywater
Copy link
Collaborator

mrgreywater commented Mar 6, 2025

Thanks for the heads up. But since we don't need any newer features, I think we should only advance to 3.5 if that's what cmake still supports. Also the README.md would probably need a small update for the required cmake version.

@musicinmybrain
Copy link
Contributor Author

Thanks for the heads up. But since we don't need any newer features, I think we should only advance to 3.5 if that's what cmake still supports. Also the README.md would probably need a small update for the required cmake version.

Ok, adjusted on both counts and force-pushed.

Looking back at CMakeLists.txt, there are a couple of workarounds that you could dispense with if you did choose to update the minimum version to 3.12:

if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 3.7)
# Allow C++11 requirements to propagate when using recent CMake versions
target_compile_features(earcut_hpp INTERFACE cxx_std_11)
endif()

# In CMake 3.12, use target_link_libraries(fixtures PUBLIC earcut_hpp libtess2).
# Since we support down to CMake 3.2, we need to manually propagate usage requirements of earcut_hpp
target_include_directories(fixtures PRIVATE "$<TARGET_PROPERTY:earcut_hpp,INTERFACE_INCLUDE_DIRECTORIES>")
target_compile_features(fixtures PRIVATE "$<TARGET_PROPERTY:earcut_hpp,INTERFACE_COMPILE_FEATURES>")

@musicinmybrain musicinmybrain changed the title Update cmake_minimum_required to 3.12; support CMake 4.0 Update cmake_minimum_required to 3.5; support CMake 4.0 Mar 6, 2025
@musicinmybrain
Copy link
Contributor Author

I’m going to update this again to set a minimum version range, 3.2...3.12. That way, CMake 3.2 will still work (as before this PR), if anyone is still using it, but CMake releases that can’t support such old policy versions (e.g., CMake 4.0 can’t support CMake<3.5, and CMake<3.10 is already deprecated) can still work with a higher minimum version.

CMake 4.0 drops support for CMake <3.5, so minimum versions need to be
adjusted for forward compatibility. Since CMake <3.10 is already
deprecated, and 3.12 is the first “modern” CMake release, let’s support
policy versions up to 3.12.

https://cmake.org/cmake/help/latest/command/cmake_minimum_required.html
@musicinmybrain musicinmybrain changed the title Update cmake_minimum_required to 3.5; support CMake 4.0 Use a range for CMake minimum versions, 3.2...3.12: support CMake 4.0 Mar 6, 2025
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

Successfully merging this pull request may close these issues.

2 participants