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

CMAKE option warnings and errors not consistent (or documented) #44

Closed
LtdSauce opened this issue Jan 24, 2022 · 7 comments
Closed

CMAKE option warnings and errors not consistent (or documented) #44

LtdSauce opened this issue Jan 24, 2022 · 7 comments
Labels
documentation Improvements or additions to documentation

Comments

@LtdSauce
Copy link
Contributor

I noticed that not all cmake warnings are turned into errors when the variable WARNING_MESSAGE is set to SEND_ERROR, hence WARNINGS_AS_ERRORS enabled.

For example a missing clang-tidy will produce an error if the corresponding option is set (see StaticAnalyzer.cmake:32).
On the other hand a missing Sanitizer is always producing a warning (see Sanitizers.cmake:27).
Same goes for a missing ccache executable (see cache.cmake:29).

I cannot find any explantation why those are treated different, which kind of confuses me.

Would it be possible to add comments why some do not use the WARNING_MESSAGE variable, if that had been done on purpose?
Which seems the case at least for clang-tidy if i correctly understand #30.

@LtdSauce
Copy link
Contributor Author

LtdSauce commented Jan 24, 2022

Maybe something like ENABLE_IF_<tool> or OPTIONAL_ENABLE_<tool> could be used for those to make it explicit, that it is always a warning and never an error? (Providing that to every option would enable the user to specify what option is optional and what is mandatory)

@LtdSauce LtdSauce changed the title CMAKE warnings and errors not consistent (or documented) CMAKE option warnings and errors not consistent (or documented) Jan 24, 2022
@aminya
Copy link
Owner

aminya commented Feb 1, 2022

WARNINGS_AS_ERRORS is used for the tools that analyze the code semantically. The compiler itself, clang-tidy, cppcheck and any other static analyzer.

@aminya aminya added the question Further information is requested label Feb 1, 2022
@LtdSauce
Copy link
Contributor Author

LtdSauce commented Feb 1, 2022

Ah i see! That makes sense.

Would you consider this to be common knowledge (that i didn't have) or is it worth adding a comment to the WARNINGS_AS_ERRORS option?

The comment now only says, that it turns Compiler warnings into errors. But, apparently it does more?

@aminya
Copy link
Owner

aminya commented Feb 1, 2022

Yes, we should add this to the docs.

P.S: I don't personally use WARNINGS_AS_ERRORS because I don't need an external force for addressing the warnings. 😉

@aminya aminya added documentation Improvements or additions to documentation and removed question Further information is requested labels Feb 3, 2022
@aminya
Copy link
Owner

aminya commented Feb 9, 2022

@LtdSauce are you interested in improving the docs here?

@LtdSauce
Copy link
Contributor Author

LtdSauce commented Feb 9, 2022

If i find the time i could open a PR.

I would suggest something like:

"Turns compiler and static code analyzer warnings into errors. This also effects cmake warnings related to those."

@aminya aminya closed this as completed in 899559b Feb 9, 2022
@aminya
Copy link
Owner

aminya commented Feb 9, 2022

Thanks! I added the commit

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

No branches or pull requests

2 participants