-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Support labeling targets with minimum-compatible C++ version #22264
Comments
There is some prior art here in how CMake handles things: https://cmake.org/cmake/help/latest/manual/cmake-compile-features.7.html#id6 There are lots of interesting questions about the semantics of this:
Thinking of the above questions, I can see a couple of over-arching themes of how this could work:
In both cases I think we have to figure out how to interact with
Footnotes
|
I had very similar problem with Java where I felt language version should be configured on a target level (with possible defaults for package/module). I haven’t solved it for Java, resorting to a global flag —java_language_version. But at least in Java, higher versions are usually backwards compatible. in C++ world “features” already support such granularity, so that’s probably the best approach. I wish to have some inputs from configurability team. Cc @katre @gregestren |
Description of the feature request:
I would like a standard way to tag a target (library, binary, or test) as requiring a minimum C++ version (e.g. C++20 and above).
Related features:
target_compatible_with
: C++ version isn't quite a property of the platform, and there isn't a standard way to detect it, since it may be configured via any of: (1) targetcopts
(2) command-line--copts=-std=c++14
(3)copts
in the toolchain definition. Even when working with a single one of these, there's no general mechanism forselect
-ing for "C++20 or greater."cc @tpudlik @trybka
Which category does this issue belong to?
C++ Rules, Core
What underlying problem are you trying to solve with this feature?
I work on a project that supports C++17. However, we'd like to offer C++20 coroutine support for users that are using C++20. I'd like to be able to declare a coroutine-compatibility target which only builds (and is only tested) when C++20 or later is enabled. Those particular library and test targets should not be built or run when using C++17.
One solution would be to
#ifdef
out the entire files such that the tests and library target still built and ran on C++17, but this would create the mistaken impression that the tests were building and running successfully, which I don't want. All dependent targets would also have to#ifdef
themselves out of existence. Additionally, users attempting to depend on my target from C++17 would encounter an opaque error (missing symbols on import) rather than a useful one.The text was updated successfully, but these errors were encountered: