Remove "-Werror" from default CMake builds#255
Remove "-Werror" from default CMake builds#255skaravos wants to merge 4 commits intoemilk:masterfrom
Conversation
Changes: - Provides a workaround for [emilk#249](emilk#249) - Adds an option that can be used to disable compile warnings for the loguru library. This could be useful for users who just want to build the library and dont care about the warnings. (or they just aren't in a position to fix them anyways). Notes: - The default behaviour remains the same: compiler-warnings are enabled by default when the project is built as a top-level project, and disabled by default when the project is included as a sub-project with either add_subdirectory() or FetchContent()
Notes: - This is needed to quiet a cmake warning about non-cache variables being used to set loguru cmake `options()`, because loguru's minimum cmake version is still 3.10 and this wasn't allowed until cmake 3.13. ``` # CMakeLists.txt # prior to cmake 3.13 the user would need to set options as cache vars set(LOGURU_ENABLE_COMPILER_WARNINGS FALSE CACHE BOOL "" FORCE) # cmake 3.13 and onwards the sub-project options respect normal vars. set(LOGURU_ENABLE_COMPILER_WARNINGS FALSE) add_subdirectory(loguru) ```
|
Just for my own information, what's the technical difference between this method and fixing the issue in the CPP code directly? Like these 2 patches are doing (https://github.com/virtuosonic/loguru/commit/e1ffdc4149083cc221d44b666a0f7e3ec4a87259.patch and https://github.com/virtuosonic/loguru/commit/743777bea361642349d4673e6a0a55912849c14f.patch) ? |
This PR addresses a different concern entirely. However, even if the C++ code gets fixed it doesn't address the fact that the default out-of-the-box CMake build for the project should not have |
Notes: - Realized I must've dropped the actual most important commit while rebasing this branch before submission, sheesh
Provides a workaround for #249
Removes
-Werrorfrom the default set of compiler warnings for GCC to lessen the impact on downstream package maintenance.Adds two new cmake options:
LOGURU_ENABLE_COMPILER_WARNINGScan be explicitly set to
FALSEto opt-out of compiler warningsLOGURU_WARNINGS_AS_ERRORSTRUEto opt-in to treating warnings as errors