-
Notifications
You must be signed in to change notification settings - Fork 17
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
use CMake's builtin support for C++ standard selection #35
base: master
Are you sure you want to change the base?
Conversation
Wouldn't be even better to use cmakes target_compile_features function to let cmake decide which compiler to use? "target_compile_features(mylib PRIVATE cxx_std_11)" Or even name the used features directly https://cmake.org/cmake/help/v3.8/manual/cmake-compile-features.7.html Btw.:We should change pocolog_cpp accordingly when we decided. |
@doudou I considered to not using the rock_activate_cxx11 macro, but then thought:
If we come to the conclusion that rock_activate_cxx11 macros should not be used anymore, we should first deprecate them in base/cmake - e.g. start adding a corresponding deprecation warning. |
I believe that CMake's mechanism is good enough, and that making its use explicit is for the best. The least amount of Rock-specific macros we have the better. That leaves only (1), but I think also fair to standardize on CMake 3.1+ |
I'm OK either way. I think that the target_compile_features makes things a lot more complicated, but I guess that's the point: the C++ library maintainer is free to use whatever CMake-provided mechanism fits its use-case best. If you want to provide a C ABI with C++11 internals, then by all means use the |
If the macro would cover only two statements, my first choice would have been clearly different. But your statement holds only if we deprecate things. Anyhow, I am fine with deprecating rock_activate_cxx11 and using the cmake standard mechanisms. |
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.
Should also set CMAKE_CXX_STANDARD_REQUIRED
Which is what I wanted to say by "it leaves us with (1)", that is whether we want to support CMake < 3.1. |
As the only supported ubutnu versions are 16.04 and 18.04 and 16.04 has cmake 3.5.1 ad default, i think it is ok not to support CMake < 3.1. |
CMake has builtin support for C++ standard selection ever since v3.1. I really think we should use this instead of the Rock macro (which, by the way, uses CMake's builtin)
See https://www.rock-robotics.org/rock-and-syskit/libraries/cpp_libraries.html#cxx_standard