Conversation
cmake_minimum_required(VERSION 2.x) has the effect that recent cmake 3.x has the defaults that were considered sensible a decade ago. Instead, use `cmake_minimum_required(VERSION 2.x..3.y)` so that newer cmake uses modern defaults for policies, without dropping cmake 2.x support.
|
ping @nemequ |
|
Note : By now, things have moved on, and we could update the minimum version, up to a maximum of It's just that there is no point in reducing compatibility (by increasing the minimum version requirement) if there is no benefit in exchange, and so far, no one has been able to articulate what is gained by updating the minimum version to something more recent. |
|
Feel free to update the PR accordingly. This is more of an issue promoted to a actionable change :p |
|
I think Consequently, I think this is the minimum version this PR should jump to. I prefer a single minimum version number, because otherwise, the |
|
Done |
| if("${CMAKE_VERSION}" VERSION_LESS "3.0") | ||
| project(LZ4 C) | ||
| else() | ||
| cmake_policy (SET CMP0048 NEW) |
There was a problem hiding this comment.
Question : is it now useless to specify this line ?
cmake_policy (SET CMP0048 NEW)
There was a problem hiding this comment.
Yeah, the policy is from 3.0 and with minimum required >= 3.0 it's automatically NEW.
The policies are always such that new cmake behaves the same as the "minimum required" cmake version.
|
Thanks @haampie |
cmake_minimum_required(VERSION 2.x)has the effect that any recent CMake runs with default settings that were considered sensible a decade ago.Instead, use
cmake_minimum_required(VERSION 2.x...3.y)so that newer CMake uses modern defaults for policies, without dropping CMake 2.x support.One such policy that I need for example is CMP0042, which makes CMake output
@rpath/liblz4.dylibas install name on macOS, so that packages linking to it register@rpath/liblz4.dylibas a load command, so that rpaths will be considered to locate it. Without it, dependents typically fail at runtime and cannot locate the library if it's in a non-system dir.