Fix required CMake version when generating CMakeLists#29
Conversation
We don't need anything lower than 3.8 anymore and higher C++ standards than 11 require higher CMake versions
|
I'm not entirely sure that this is what we want here. |
|
In which way? So mapping the version to the right CMake version is just avoiding this bug. As for dropping CMake 3.5 where possible: Given that BoostRoot now requires CMake 3.8 I don't see any value in using a lower version. |
|
Suppose we have a few C++23 libraries in Boost, and the user wants to install Boost using CMake 3.16. I agree that the current state is to issue an error, and that this is undesirable. But I'm not sure that issuing a different, better, error at configure time is particularly useful. This forces the user to care about libraries about which he may not care at all, and to manually exclude them. I of course do not object to always requiring 3.8. |
Why is it not useful to issue a better error if we do have to issue an error in all cases?
Exactly: He has to exclude all libraries that are not compatible with CMake 3.16 (because they are using C++23) as otherwise he will get an error. That is the case with and without this PR, the only difference is the place where the error occurs. Currently the error shows at generate time for the affected libraries and their dependencies which makes it not clear which library is the one stopping the build, although of course all have to be excluded anyway. I found that while opening PRs for CMake 3.8 in libraries where "Unknown cxx_std_11 feature" showed. Boost.Filesystem didn't use it but depended on a library that does. This change shows a clear error "CMake version too low" for the library that requires it and upon exclusion would show an undeclared target on e.g. Boost.Filesystem referencing a library that was excluded. IMO this is much better to understand and follow for users. If we really do not want to issue an error if possible we could conditionally exclude libraries based on the declared CMake version as I did in the CI for boostorg/cmake. That of course requires the correct CMake version to be declared in the first place and falls short for dependent libraries. |
I didn't say that at all. |
|
Then I don't understand what you meant. Could you clarify please? I'd say this PR is strictly an improvement over the current state, isn't it? |
It is a strict improvement, yes. What I had in mind was that, instead of we could for example have although maybe it's not worth the bother. I'll think about it some more. |
That would just move the error further away, to compile time, if the compilers default C++ level doesn't happen to be C++23 Of course we can implement something in CMake like IMO not worth the bother though |
We don't need anything lower than 3.8 anymore and higher C++ standards than 11 require higher CMake versions