-
Notifications
You must be signed in to change notification settings - Fork 6.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 C++17 features in Catch2 #25236
Comments
We do not accept adding c/cxx standard as a feature. |
What is the recommended solution to provide a port that "just works" for consumers on C++17 or higher? The abseil[cxx17] technique from the linked page? |
You could modify the local files manually, add following sentences in the portfile.cmake file.
|
I'm looking for a way that doesn't require using a port overlay (or patch on top of the vcpkg repo). What's the current best solution in vcpkg? (Perhaps there's a larger vcpkg feature ask here.) |
The best way is to let upstream itself set the default language standard to c++17. |
Upstream intentionally supports back to C++14, as documented in their About section here: How do other upstream libraries handle supporting older C++ versions? |
It is their freedom to use that language standard upstream, vcpkg does not make any restrictions on this. |
Does vcpkg support projects that offer compilation with multiple language versions, with a lower minimum but more features on more recent versions (without requiring consumers to use overlay ports)? |
If the port itself supports the use of different language standards under different conditions, then vcpkg supports such a port using different conditions as its own feature. |
In that case, can we add a c++17 feature to the catch2 port? (Or am I misunderstanding your reply?) |
Are there explicit conditions in the cmakelists.txt provided by upstrem to control the use of c++17 or c++14? |
Not that I see, though I'm not a CMake expert: What would upstream need to do for vcpkg to support a c++17 feature for it? |
Upstream clearly mentions c++17 only in https://github.com/catchorg/Catch2/blob/devel/fuzzing/CMakeLists.txt (I only found this part):
The above part is controlled by the following conditions in https://github.com/catchorg/Catch2/blob/devel/CMakeLists.txt:
And |
I think that feature is just about fuzz testing: One feature I'm interested in is guarded by CATCH_CONFIG_CPP17_STRING_VIEW. There's a C++17 toggle to force it on, but support normally comes via CATCH_INTERNAL_CONFIG_CPP17_STRING_VIEW which is then controlled by CATCH_CPP17_OR_GREATER which is then controlled by normal C++ version macros such as __cplusplus or _MSVC_LANG. Could we add a feature that controls whether __cplusplus/_MSVC_LANG is C++17, which then means all the C++ 17 features (uncaught_exceptions, string_view, variant, optional, byte) light up? |
Could you please submit a PR for this issue? |
Does the Catch2 port support compiling with C++17 features enabled?
For example:
I get a linker error when using catch2 v3.0.1 but not when using v2.*.
Note that Catch2 compiles with C++14 by default.
For more context, see:
catchorg/Catch2#2046
catchorg/Catch2#2210
Is some kind of feature switch needed, or should the port just always use C++17?
The text was updated successfully, but these errors were encountered: