Skip to content

src/CMakeLists.txt: add CFLAGS="-Werror" only in Debug builds#156

Merged
tomghuang merged 1 commit into
argtable:masterfrom
orlitzky:werror-only-for-debug
Jun 18, 2026
Merged

src/CMakeLists.txt: add CFLAGS="-Werror" only in Debug builds#156
tomghuang merged 1 commit into
argtable:masterfrom
orlitzky:werror-only-for-debug

Conversation

@orlitzky

Copy link
Copy Markdown
Contributor

New versions of GCC and Clang often bring fresh warnings that will break old releases when -Werror is in CFLAGS. It's still desirable to have -Werror enabled during development (where you can actually fix any errors that arise), so as a compromise, this commit changes the addition of -Werror to affect only "Debug" builds.

Distributions and end users who make release builds with newer compilers will still see the warnings, they just won't be fatal.

Background: We have argtable3 in Gentoo linux, where installing a package means building it from source. For us -Werror is a big headache, because when some newer GCC or clang adds a new warning, it prevents packages that use -Werror from being installed. I recently added a small sed to our argtable3 package to strip -Werror, but thought it might be useful to others if it were added only in Debug builds.

New versions of GCC and Clang often bring fresh warnings that will
break old releases when -Werror is in CFLAGS. It's still desirable to
have -Werror enabled during development (where you can actually fix
any errors that arise), so as a compromise, this commit changes the
addition of -Werror to affect only "Debug" builds (this is what's
documented in the README.md).

Distributions and end users who make release builds with newer
compilers will still see the warnings, they just won't be fatal.
@tomghuang tomghuang merged commit 9ba95aa into argtable:master Jun 18, 2026
10 of 14 checks passed
@tomghuang

Copy link
Copy Markdown
Contributor

@orlitzky: Really appreciate your patch.

@tomghuang

Copy link
Copy Markdown
Contributor

@orlitzky: One question. Do I have to create an official release build for Gentoo's integration? I'm curious that, does Gentoo only pull the official release of packages, or it pull the latest commit?

@orlitzky

Copy link
Copy Markdown
Contributor Author

Thank you! We prefer official releases, but there is no emergency. This will help avoid problems in the future, but the current GCC 16 and Clang 23 are working OK as far as I know.

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.

2 participants