-
Notifications
You must be signed in to change notification settings - Fork 54
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
Avoid setting CMAKE_CXX_STANDARD explicitly in libraries #44
Comments
While I'm in favour of suggesting this, I think there might be a reason for having it in some cases, for example, if your code uses some c++ deprecated features, removed in c++17 (e.g. I'm not 100% sure if this is true, and the documentation does not specify it, but if I remember correctly, I added it in YARP when GCC switched to have c++14 enabled by default, and YARP was being compiled without the
Looking forward to that day! |
robotology/how-to-export-cpp-library#44 Signed-off-by: black-desk <me@black-desk.cn>
robotology/how-to-export-cpp-library#44 Signed-off-by: black-desk <me@black-desk.cn>
robotology/how-to-export-cpp-library#44 Signed-off-by: black-desk <me@black-desk.cn>
In abseil/abseil-cpp#259 (comment) , a good point is made against setting
CMAKE_CXX_STANDARD
explicitly in libraries, in favor of just usingtarget_compile_features(mylib PUBLIC cxx_std_11)
to specify the minimum required standard language to compile.We never set the
CMAKE_CXX_STANDARD
in this tutorial, but as the use of settingCMAKE_CXX_STANDARD
is widespread in robotology libraries, it would be good to have one point where we discuss this. Requiring CMake 3.10 would be a good occasion to switch to usetarget_compile_features(mylib PUBLIC cxx_std_11)
.The text was updated successfully, but these errors were encountered: