Closed BurningEnlightenment closed 7 months ago
Thank you! Out of curiosity, if I had to figure out the right way to do something like this myself, where would I have found it? This all seems...very non-obvious...
Well, the main problem with CMake is the amount of cruft accumulated until CMake 3 refocused on targets and their properties. So if you google something and the solution involves set()
ing CMAKE_
variables it is probably outdated. The reference documentation is fairly comprehensive, but it requires a bit of digging to grok the way it's structured.
A good starting point is the Tutorial section of the reference manual. In this case it would've already covered 90% of the topic. The unintuitive parts about compiler extensions are things I've learned the hard way--through user complaints about things blowing up in their face 🙃
Specify language requirement as a compile-feature and force compiler extensions off ensuring portability problems are detected early on. Note that we do not use the
C_STANDARD
property, because it doesn't propagate to dependent targets and would prohibit users from compiling their code base with consistent flags / language configuations if they were to target a newer C standard. Similarly we do not configureC_STANDARD_REQUIRED
as compile-features do not interact with it--they are enforced regardless.Closes #348