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

Include directories should be set to SYSTEM if not stand-alone #833

Closed
Krzmbrzl opened this issue Jan 19, 2023 · 2 comments · Fixed by #844
Closed

Include directories should be set to SYSTEM if not stand-alone #833

Krzmbrzl opened this issue Jan 19, 2023 · 2 comments · Fixed by #844

Comments

@Krzmbrzl
Copy link
Contributor

If CLI11 is not built as a standalone library, but instead as part of another project (e.g. via submodule or via cmake's FetchContent) target_include_directories should make use of the SYSTEM option. This will have the effect that the compiler will not emit any warnings for these include files, even if included in files for which the warning settings would normally cause a warning to be emitted.

So as a trivial example, if in your header you somewhere had

unsigned int i = -1;

and I compile my project with -Wsign-conversion, I get a warning for this line in your header, if I include that in my source file (for which that warning applies). Marking the CLI11 headers as "system headers" will make the compiler silently ignore that warning - which seems to be what downstream users want...

@Krzmbrzl
Copy link
Contributor Author

Note: If you agree that this is desirable, I could create a PR for this

@phlptp
Copy link
Collaborator

phlptp commented Jan 26, 2023

I think this would be of interest.

Krzmbrzl added a commit to Krzmbrzl/CLI11 that referenced this issue Feb 9, 2023
When including CLI11 in a separate project (e.g. via FetchContent) cmake
will now mark the CLI11 include files as system includes, which prevents
compilers from issuing any warnings for stuff it found inside these
headers. This makes sure that downstream users are not confronted with
potential warning messages from CLI11, regardless of what kind of
obscure warnings they might have enabled for their projects.

Fixes CLIUtils#833
phlptp pushed a commit that referenced this issue Feb 10, 2023
When including CLI11 in a separate project (e.g. via FetchContent) cmake
will now mark the CLI11 include files as system includes, which prevents
compilers from issuing any warnings for stuff it found inside these
headers. This makes sure that downstream users are not confronted with
potential warning messages from CLI11, regardless of what kind of
obscure warnings they might have enabled for their projects.

Fixes #833
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 a pull request may close this issue.

2 participants