-
|
I have an executable that I wish I use c++23 with. My dependencies are custom local ports, some with minimum versions of c++17 with convenience changes for c++20, others with c++20, but optional changes to expanding interface using c++23. The later cases includes a std variant with a float16 type, so is not compatible with just forcing the executable to be c++23. I would like to force these dependencies to be able to take advantage of newer versions. I tried setting the version in my cmake cache before even setting the cmake toolchain file but that didn't work. I looked up online but it was excruciating finding any kind of standard practice here. I saw something from a long time ago claiming I could make my own toolchain and force the version there, but that sounds obnoxious, and if that was the expected solution there's zero way there wouldn't be a way to deal with that at the vcpkg configuration level instead, so I don't know if that makes sense to do. The other thing I saw were people claiming (with out examples of this in practice) that you might use features instead to handle this, so I would enable the c++20 feature and c++23 feature respectively. Because these features are additive in the ports I'm talking about this might make sense but Im wary of doing this because I haven't seen prior art or official recommendations to do this. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
|
The canonical way to set global compiler-related flags is to set them in a toolchain file. |
Beta Was this translation helpful? Give feedback.
The canonical way to set global compiler-related flags is to set them in a toolchain file.
If you don't want to write your own toolchain you can use convenience variables provided by default vcpkg toolchains:
VCPKG_C_FLAGSandVCPKG_CXX_FLAGS.Note that vcpkg toolchain is not your project toolchain so you have to set flags in both places.