Closed Wohlstand closed 12 months ago
I don't know the detailed behaviour of setting the maximum version.
But, in my opinion, Setting the maximum version 3.5 seems too low.
GitHub Actions checks this cmake file is working on 2.8 and 3.10, the latest LTS Ubuntu distributed version(currently 3.22) without any problem.
As I understood, Invoking cmake_minimum_version
with max affects policies. At least, This CMakeLists uses CMP0077
- introduced in 3.13. Also, Any policies are set NEW if available and have shown a warning.
So, I should investigate the behaviour of setting the maximum version on the latest version to determine the correct maximum version.
Thank you.
The thing I made is a range. I.e. rather to define one single minimal version, the range of versions is set. So, compatibility with old versions of CMake should work, and the warning should get away. Suggested to use minimum version at least 3.2, basically because of old environments where is an old CMake by default. The standard of C doesn't matters to CMake version, it's a compiler option to enforce one specific standard version. I do run several library projects where I enforce the C90 standard (to locally ensure that's is no compatibility broken), and I use latest CMake versions normally.
What about CMake policies, I usually do:
if(POLICY CMPXXXX)
cmake_polocy(CMPXXXX NEW)
endif()
And the rest of cases on my end aren't affected so much. However, it's always suggested to review the code and each policy to ensure all is fine.
Usually if any CMake policy got affected, the related warning will be printed, so, you need to add an explicit policy definition to shut it up.
And also, it's always possible to set different code branches depending on CMake versions to keen an ability to use new feature, and at the same time, have an ability to save compatibility and using an alternative implementation.
Thank you for the description. It will be okay to use 3.5 for policy_max
.