Open SidneyCogdill opened 3 weeks ago
Also note that CMake itself supports setting the warnings-as-errors flag without requiring target_compile_options
: https://cmake.org/cmake/help/latest/variable/CMAKE_COMPILE_WARNING_AS_ERROR.html
Hi, Thanks for opening this. The OpenSSF recommendation seems fine and I think it would be reasonable to either have a flag to enable -Werror locally or a flag to disable it when packaged. The reason -Werror is used right now is that warnings are usually something I want to take care of. In this case the fix is simple, there are just some non-ascii quotes in the file.
@jeremy-rifkin -Werror could be set private and put in something like $<$<BOOL:${IS_MAIN_PROJECT}>:-Werror>
.
Currently
/WX
is enabled for MSVC:https://github.com/jeremy-rifkin/libassert/blob/df3a4bdfa5d6f80999ae0b381b298dfd1c277402/CMakeLists.txt#L119
And this causes problems when installing the package from conan package manager:
(The offending character that triggers C4819 is probably in the comments and shouldn't interfere with compilation)
Quoting from OpenSSF Hardening Guide:
Note that changing to
$<$<AND:$<CONFIG:Debug>,$<CXX_COMPILER_ID:MSVC>>:/W4 /WX>
doesn't help in this case as conan will follow CMake's configuration and compile with Debug mode if the user is using Debug build. Ideally there would be a separate CMake preset for development in additional to the default preset for package distribution. Or, an easier way would be to just define a cached variable to indicate that you want to use "development mode" (which is off by default) and enable all the things that aren't suitable for distribution.