-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
buildsystem: relax requirement on cmake version #1409
Conversation
Commit 73cc508 (Using target_compile_features to specify C++ 11 standard) bumped the required cmake version, from 3.0 to 3.8, so as to get the definition of target_compile_features(). However, target_compile_features() was introduced in cmake-3.1: https://cmake.org/cmake/help/v3.1/command/target_compile_features.html And using cmake-3.1 is indeed sufficient to properly build. As such, relax the minimum required version down to cmake-3.1, so we can build on oldish, entreprise-grade distributions that only have cmake-3.1 (or at least, don't have up to cmake-3.8). Reported-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Thanks for the PR! I’ll check it soon. |
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.
Looks good to me.
Thanks! |
@nlohmann Thanks for the quick handling of the MR! :-) Happy New Year and best wishes! |
Sorry to be late, but I think this PR will actually break things for old CMake-versions. Indeed One possible solution before 3.8 to solve a dependency to C++11 with |
@pboettch Thanks for reporting! |
@pboettch Indeed, However, I've actually been able to build with just cmake-3.1. |
GCC from version 5 on enables C++11 by default, however, cmake should moan about the unknown feature. |
Error on my side: even gcc 5.4 does NOT (edit) build c++11 by default. |
I just tried on a Ubuntu 14.04 platform which uses cmake 3.5.1 the following: add_executable(t t.cpp)
target_compile_features(t PRIVATE cxx_std_11) And I got
|
@pboettch Arg.. I had a more recent version of cmake lying around, that was Shall I send a revert, or will you do? (lesson learnt: next time, do not append to |
@yann-morin-1998 If you change it to |
@pboettch So, replacing |
Just to nitpick: are there compilers that support range fors but not the rest? |
Maybe some versions before GCC 4.8. IOW versions of compilers which had partial support of some C++11 features. Normally you should already not support these compilers. AFAIK, CMake cxx_range_for pulls in C++11 support on GCC, Clang and VS. |
@nlohmann @pboettch Here's what it got me:
So it is using the |
That's CMake's default for GCC when C++11 is required. |
Would someone volunteer for a PR on this issue? |
@nlohmann In the meantime, until I actually come up with a PR, you should just revert the merge, no? |
No, do not revert the merge. There is no need to rush here. But it would be great to get back to the earlier CMake prerequisite with the next release. |
So basically this would work, right? if (${CMAKE_VERSION} VERSION_LESS "3.8.0")
target_compile_features(catch_main PUBLIC cxx_range_for)
else()
target_compile_features(catch_main PUBLIC cxx_std_11)
endif() |
Commit 73cc508 (Using target_compile_features to specify C++ 11
standard) bumped the required cmake version, from 3.0 to 3.8, so
as to get the definition of target_compile_features().
However, target_compile_features() was introduced in cmake-3.1:
https://cmake.org/cmake/help/v3.1/command/target_compile_features.html
And using cmake-3.1 is indeed sufficient to properly build.
As such, relax the minimum required version down to cmake-3.1,
so we can build on oldish, entreprise-grade distributions that
only have cmake-3.1 (or at least, don't have up to cmake-3.8).
Reported-by: Thomas Petazzoni thomas.petazzoni@bootlin.com
Signed-off-by: "Yann E. MORIN" yann.morin.1998@free.fr