build: scope warnings-as-error to project targets, not FetchContent subprojects#819
build: scope warnings-as-error to project targets, not FetchContent subprojects#819yadavay-amzn wants to merge 1 commit into
Conversation
|
Could you please configure pre-commit locally? It seems the patch contains some unnecessary changes. |
1131c39 to
e8a1856
Compare
|
Done - configured pre-commit locally with the pinned cmake-format (v0.6.10), reverted the unrelated cosmetic reformattings, and re-pushed. The diff now contains only the warnings-as-error scoping change and passes pre-commit. |
evindj
left a comment
There was a problem hiding this comment.
The change looks good to me. However, I wonder if this comes from an hypothetical or an actual occurence where the dependencies triggering the issue was not able/willing to address. I generally agree that we should do this but I wonder if relaxing the requirement causes side effects.
|
Thanks @evindj - it's a real occurrence, not hypothetical. Arrow injects its own -Werror during its build, and as noted on the issue by @wgtmac/@zhjwpku the global CMAKE_COMPILE_WARNING_AS_ERROR does not reliably stay off for FetchContent subprojects, so a warning in a bundled dependency can fail our build. On side effects: this does not relax our own strictness - iceberg's own shared/static targets keep -Werror via a per-target COMPILE_WARNING_AS_ERROR property. It only stops us from imposing -Werror on third-party subprojects we don't control, which is the intended behavior (a dependency's warnings shouldn't fail our build, and we can't fix their code). So our code stays exactly as strict as before; only the vendored dependencies are no longer forced warning-clean under our flags. |
What
Fixes #246.
-Werror(via a globalCMAKE_COMPILE_WARNING_AS_ERROR) leaked into FetchContent-built dependencies, so a warning in a third-party subproject (e.g. Arrow) could fail the whole build. As noted on the issue, the global flag does not reliably isolate subprojects.How
CMAKE_COMPILE_WARNING_AS_ERROR ON.COMPILE_WARNING_AS_ERROR ONas a per-target property on Iceberg's own shared/static libraries, so the project stays strict.BUILD_WARNING_LEVEL PRODUCTIONfor Arrow to suppress its independent-Werrorinjection.prepare_fetchcontent()for the case where-DCMAKE_COMPILE_WARNING_AS_ERROR=ONis passed on the command line.Verified
Iceberg targets still compile with
-Werror; FetchContent subprojects do not. Build + tests green (18/18).This contribution was authored with assistance from Claude Opus 4.8, in line with the Iceberg guidelines for AI-assisted contributions (https://iceberg.apache.org/contribute/#guidelines-for-ai-assisted-contributions). All changes were reviewed and tested by the author.