build (cmake): `LIBZMQ_WERROR` is broken
fanquake opened this issue · comments
fanquake commented
Issue description
Usage of LIBZMQ_WERROR
is mostly broken, because the build system is throwing other warnings when usage of the flag is being tested. i.e when building using GCC 14.1.1:
/usr/lib64/ccache/c++ -std=c++11 -Wno-tautological-constant-compare -DHAVE_FLAG_-Werror -Werror -o CMakeFiles/cmTC_bc312.dir/src.cxx.o -c /root/libzmq/build/CMakeFiles/CMakeScratch/TryCompile-QS6bbk/src.cxx
<command-line>: error: ISO C++11 requires whitespace after the macro name [-Werror]
cc1plus: note: unrecognized command-line option '-Wno-tautological-constant-compare' may have been intended to silence earlier diagnostics
cc1plus: all warnings being treated as errors
The same happens under Clang 18.1.7:
/usr/lib64/ccache/clang++ -std=c++11 -Wno-tautological-constant-compare -Wall -Wextra -Wno-long-long -Wno-uninitialized -pedantic -DHAVE_FLAG_-Werror -Werror -MD -MT CMakeFiles/cmTC_90abf.dir/src.cxx.o -MF CMakeFiles/cmTC_90abf.dir/src.cxx.o.d -o CMakeFiles/cmTC_90abf.dir/src.cxx.o -c /root/libzmq/build/CMakeFiles/CMakeScratch/TryCompile-N1gFrx/src.cxx
In file included from <built-in>:430:
<command line>:1:19: error: ISO C99 requires whitespace after the macro name [-Werror,-Wc99-extensions]
1 | #define HAVE_FLAG_-Werror 1
| ^
1 error generated.
The -Werror
test converts this warning (ISO C++11 requires whitespace after the macro name
) into an error, and -Werror
is never added as a build flag. Note that this likely effects a number of other options/checks as well.
Environment
- libzmq version (commit hash if unreleased): c2fae81
- OS: Fedora
Minimal test code / Steps to reproduce the issue
cmake -B build
What's the actual result? (include assertion message & call stack if applicable)
-- Performing Test HAVE_FLAG_-Werror
-- Performing Test HAVE_FLAG_-Werror - Failed
What's the expected result?
-- Performing Test HAVE_FLAG_-Werror
-- Performing Test HAVE_FLAG_-Werror - Success