Skip to content

Allow users to opt-out or select subset of warnings #746

@ManifoldFR

Description

@ManifoldFR

Right now, compiler.cmake introduces the following warnings:

macro(_SETUP_PROJECT_WARNINGS)
# -Wmissing-declarations is disabled for now as older GCC version does not
# support it but CMake doest not check for the flag acceptance correctly.
set(
GNU_FLAGS
-pedantic
-Wno-long-long
-Wall
-Wextra
-Wcast-align
-Wcast-qual
-Wformat
-Wwrite-strings
-Wconversion
)
if(NOT DEFINED CXX_DISABLE_WERROR)
list(APPEND GNU_FLAGS -Werror)
endif(NOT DEFINED CXX_DISABLE_WERROR)

In particular, -pedantic and -Wall introduce quite a lot of warnings. For interacting with some third-party header-only C/C++ libraries like magic_enum, -Wmissing-field-initializers and -Wconversion on GCC can get really spammy and annoying.

Another thing is that these flags are set globally, instead of on a per-target basis.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions