-
Notifications
You must be signed in to change notification settings - Fork 47
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
require CMake >= 3.10, fix #338 #620
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than the small requested change it looks good to me. Thanks @nim65s for taking this on :)
Sorry about the comment after the fact but this came to me after reviewing the PR, I think the changes around policy manipulation must be reverted. While we check that This means that we can have a project with |
true :/ |
I'll try to just add |
So in eigenpy, with latest jrl-cmakemodule master, +
Adding |
What happens the other way around? e.g. |
In that case, eigenpy is configuring / building fine, but I have no idea about how policies between 3.10 and 3.20 are treated. The doc is not clear about what happen on multiple calls of this function https://cmake.org/cmake/help/latest/command/cmake_minimum_required.html https://cmake.org/cmake/help/latest/command/cmake_policy.html#command:cmake_policy hints that we can GET to check this, I'll try |
cmake_minimum_required(VERSION 3.1)
cmake_policy(GET CMP0050 fifty)
cmake_policy(GET CMP0070 seventy)
cmake_policy(GET CMP0090 ninety)
message(STATUS "after 3.1: ${fifthy} ${seventy} ${ninety}")
cmake_minimum_required(VERSION 3.10)
cmake_policy(GET CMP0050 fifty)
cmake_policy(GET CMP0070 seventy)
cmake_policy(GET CMP0090 ninety)
message(STATUS "after 3.10: ${fifthy} ${seventy} ${ninety}")
cmake_minimum_required(VERSION 3.20)
cmake_policy(GET CMP0050 fifty)
cmake_policy(GET CMP0070 seventy)
cmake_policy(GET CMP0090 ninety)
message(STATUS "after 3.20: ${fifthy} ${seventy} ${ninety}")
cmake_minimum_required(VERSION 3.10)
cmake_policy(GET CMP0050 fifty)
cmake_policy(GET CMP0070 seventy)
cmake_policy(GET CMP0090 ninety)
message(STATUS "after 3.10: ${fifthy} ${seventy} ${ninety}")
project(something)
So #621 is a bad idea. |
A simple additional check should work: cmake_minimum_required(VERSION 3.1)
cmake_policy(GET CMP0050 fifty)
cmake_policy(GET CMP0070 seventy)
cmake_policy(GET CMP0090 ninety)
message(STATUS "after 3.1: ${fifthy} ${seventy} ${ninety}")
if(CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 3.10)
cmake_minimum_required(VERSION 3.10)
endif()
cmake_policy(GET CMP0050 fifty)
cmake_policy(GET CMP0070 seventy)
cmake_policy(GET CMP0090 ninety)
message(STATUS "after 3.10: ${fifthy} ${seventy} ${ninety}")
if(CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 3.20)
cmake_minimum_required(VERSION 3.20)
endif()
cmake_policy(GET CMP0050 fifty)
cmake_policy(GET CMP0070 seventy)
cmake_policy(GET CMP0090 ninety)
message(STATUS "after 3.20: ${fifthy} ${seventy} ${ninety}")
if(CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 3.10)
cmake_minimum_required(VERSION 3.10)
endif()
cmake_policy(GET CMP0050 fifty)
cmake_policy(GET CMP0070 seventy)
cmake_policy(GET CMP0090 ninety)
message(STATUS "after 3.10: ${fifthy} ${seventy} ${ninety}")
project(something) -- after 3.1: |
I tried locally and I was getting a different result. It turns out that whether Another edge case that I can think of is if someone is explicitly relying on some OLD policy since jrl-cmakemodules was careful about not affecting the global project policy before (I'm not aware of any project that would be affected but that's something to consider) I think the path that would lead to the least breakage would be to keep the policy updates that we were doing before. Furthermore, it's easier to track the breakage if the maintainer upgrades the minimum required rather than if it breaks because jrl-cmakemodules are updated. |
On the scope of the included file… I'm not sure, but it might be better to check for For people explicitely relying on OLD policy, this is not an issue I think, as this looks to be handled correctly: cmake_minimum_required(VERSION 3.1)
cmake_policy(GET CMP0050 fifty)
cmake_policy(GET CMP0070 seventy)
cmake_policy(GET CMP0090 ninety)
message(STATUS "after 3.1: 50-${fifty} 70-${seventy} 90-${ninety}")
if(CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 3.10)
cmake_minimum_required(VERSION 3.10)
endif()
cmake_policy(GET CMP0050 fifty)
cmake_policy(GET CMP0070 seventy)
cmake_policy(GET CMP0090 ninety)
message(STATUS "after 3.10: 50-${fifty} 70-${seventy} 90-${ninety}")
if(CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 3.20)
cmake_minimum_required(VERSION 3.20)
endif()
cmake_policy(GET CMP0050 fifty)
cmake_policy(GET CMP0070 seventy)
cmake_policy(GET CMP0090 ninety)
message(STATUS "after 3.20: 50-${fifty} 70-${seventy} 90-${ninety}")
if(CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 3.10)
cmake_minimum_required(VERSION 3.10)
endif()
cmake_policy(GET CMP0050 fifty)
cmake_policy(GET CMP0070 seventy)
cmake_policy(GET CMP0090 ninety)
message(STATUS "after 3.10: 50-${fifty} 70-${seventy} 90-${ninety}")
cmake_policy(SET CMP0050 OLD)
cmake_policy(GET CMP0050 fifty)
cmake_policy(GET CMP0070 seventy)
cmake_policy(GET CMP0090 ninety)
message(STATUS "after OLD: 50-${fifty} 70-${seventy} 90-${ninety}")
if(CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 3.10)
cmake_minimum_required(VERSION 3.10)
endif()
cmake_policy(GET CMP0050 fifty)
cmake_policy(GET CMP0070 seventy)
cmake_policy(GET CMP0090 ninety)
message(STATUS "after 3.10: 50-${fifty} 70-${seventy} 90-${ninety}")
project(something)
|
Hi,
CMake 3.27 now show the following warning:
So I guess this is time to enforce #338, where 3.10 was the latest consensual version in the discussion.