On Wed, Dec 21, 2022 at 19:33:48 +0100, Alejandro Colomar via Gcc wrote: > I've long had this wish: an option similar to -std, but which would not > specify > the standard. Rather, mark a requirement that the standard be at least a > version. > > This would be especially useful for libraries, which might for example > require > C99 or C11 to work. They would be able to specify -minstd=c11 in their pc(5) > file (for use with pkgconf(1)). That way, a program using such library, > would > be free to use -std to specify the C version that the project should be > compiled > with; maybe gnu17, maybe even gnu2x. But if the program tries to compile > under, > say gnu89, the compiler would report an error.
(FD: CMake developer, ISO C++ SG15 committee member) I'd like to see us move away from "flag soup" and instead towards more structured information here. This request corresponds to CMake's `C_STANDARD` target property[1] which CMake then puts together to mean something. Note that there are real hazards with just putting the flags like this into `.pc` files directly. If you have a C library and say "-minstd=c99" and I'm C++, what is supposed to happen with this flag for a C++ compilre? Does it translate to C++11 (which is the first C++ standard to "fully contain" C99)? What if there is no answer (e.g., `-minstd=c23`)? FWIW, my idea is to broaden the concept CMake has of "usage requirements" to not be so CMake-centered and to encompass things like "you need an rpath to X to use my libraries" or even "here's an entry for `PYTHONPATH` to use my Python code". ISO C++'s SG15 has started discussion of such things with an eye towards standardization here: https://github.com/isocpp/pkg-fmt --Ben [1]https://cmake.org/cmake/help/latest/prop_tgt/C_STANDARD.html