-
Notifications
You must be signed in to change notification settings - Fork 1k
Description
Description
Deciding to treat warnings as errors should be left to the consumer compiling the library rather than being enforced by the compile flags set inside the CMakeLists.txt file. Producing no compiler warnings is a goal every developer should strive for, it is impossible to check every possible configuration that consumers of a library may have.
Currently on our environment the following warnings are being produced causing the build to fail
libCPR\src\cpr\error.cpp(167,19): error: no newline at end of file [-Werror,-Wnewline-eof]
[build] 167 | } // namespace cpr
libCPR\src\include\cpr/threadpool.h(85,70): error: declaration shadows a local variable [-Werror,-Wshadow-uncaptured-local]
[build] 85 | auto task = std::make_shared<std::packaged_task<RetType()>>([fn = std::forward<Fn>(fn), args...]() mutable { return std::invoke(fn, args...); });
Example/How to Reproduce
- Setup an environment as described in additional context section
- Attempt to compile
Possible Fix
Follow modern CMake best practices by not turning warnings into errors inside the CMakeLists.txt file. Users / CI builds can turn this on by either setting COMPILE_WARNING_AS_ERROR variable on the command line or by setting the 'CMAKE_COMPILE_WARNING_AS_ERROR' cache variable if using presets
For info on this setting can be found here
Where did you get it from?
GitHub (branch e.g. master)
Additional Context/Your Environment
- OS: Windows 10
- Compiler: Clang for windows version 17.0.3
- Build System: Ninja
- libCPR Version: 1.11.1