ericniebler / range-v3

Range library for C++14/17/20, basis for C++20's std::ranges
Other
4.06k stars 437 forks source link

cmake change requires version 3.15 but did not bump cmake_minimum_required from 3.6 #1724

Open KarateSnowMachine opened 1 year ago

KarateSnowMachine commented 1 year ago

This commit introduces COMPILE_LANG_AND_ID which was added cmake 3.15. However, this change did not bump cmake_minimum_required (currently at 3.6) and thus is causing build issues for me. While I have an easy workaround for my own use-case, it would be nice to fix this so it doesn't break downstream projects.

alexreinking commented 1 year ago

I wrote a blog post about this class of bug. This is #1 on the list:

You must also test with the actual CMake 3.X release on your local development machine and on CI.

Why? Simply because the policy mechanism ensures backwards compatibility, not forwards compatibility. If you use a more recent CMake version, nothing will stop you from using a feature that is too new for the declared minimum version. This is very, very common, too. Here are three examples off the top of my head that have bitten me:

  • You might use a generator expression that was not in the old CMake version. CMake will not even try to warn you about this, and many common and useful generator expressions were introduced later than you think.

https://alexreinking.com/blog/how-to-use-cmake-without-the-agonizing-pain-part-1.html

brevzin commented 1 year ago

@alexreinking So is this fix just changing the minimum version to 3.15 or what? I don't have a ton of cmake versions on my box, and the CI job here is more concerned about testing a lot of compilers.

alexreinking commented 1 year ago

I would suggest bumping the minimum version to 3.15 (at least, it's getting to be a bit old at this point) and then adding a single CI job that tests CMake 3.15.