Feature-request: pattern to check for c++ feature support without adding -std=c++NN to the compiler command line
I have a request/question about a feature. It is related to the usage of CMAKE_CXX_STANDARD
.
I have recently updated icu4c (75.1) on my fedora-based machine on which I have a number of custom built packages. The library now requires c++17 compiler support: https://icu.unicode.org/download/#h.b36ucggz11yj
What I observe is that there are several packages that need recompiling against this new version that set CXX_CMAKE_STANDARD to a lower version and they fail to build. E.g.: xerces-c (https://github.com/apache/xerces-c/blob/v3.2.5/CMakeLists.txt#L26) Most of such packages built fine on my machine using "g++ (GCC) 13.2.0" without setting any standard, i.e. removing the CXX_CMAKE_STANDARD logic. But this requires patching.
I have the impression that at the time of writing such CMakeLists.txt
files, the reading often is: "I know my code needs at least standard 14 to compile". But as time goes by the result become more like: "The latest standard you can use to compile is standard 14".
I wonder whether it is possible and useful to have a check that says: does my compiler support standard 14 without any additional flags? I think such a check would not suffer from this change of reading over time.
Thank you for your time,
Sacha