Skip to content
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

build(CMake): Require C99 mode #365

Merged

Conversation

BurningEnlightenment
Copy link
Collaborator

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 configure C_STANDARD_REQUIRED as compile-features do not interact with it--they are enforced regardless.

Closes #348

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 configure
`C_STANDARD_REQUIRED` as [compile-features] do not interact with
it--they are enforced regardless.

[compile-feature]: https://cmake.org/cmake/help/latest/manual/cmake-compile-features.7.html#compile-feature-requirements
@oconnor663 oconnor663 merged commit 7ce2aa4 into BLAKE3-team:master Dec 2, 2023
50 checks passed
@oconnor663
Copy link
Member

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...

@BurningEnlightenment
Copy link
Collaborator Author

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 🙃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

One comma too many
2 participants