Skip to content

Include directories should be marked as system includes #2644

Description

@hadrielk

When compiling fmt by the direct CMake add_subdirectory(fmt) method (as recommended in the docs), the fmt build inherits the same compilation flags as the project including it.

But it fails for various errors/warnings, in clang at least.

For example missing-noreturn, signed-enum-bitfield, and documentation-unknown-command:

In file included from /fmt/include/fmt/format.h:48:
/fmt/include/fmt/core.h:451:5: error: unknown command tag name [-Werror,-Wdocumentation-unknown-command]
    \rst
    ^~~~
/fmt/include/fmt/core.h:604:38: error: function 'on_error' could be declared with attribute 'noreturn' [-Werror,-Wmissing-noreturn]
  void on_error(const char* message) { throw_format_error(message); }
                                     ^
/fmt/include/fmt/core.h:2075:9: error: enums in the Microsoft ABI are signed integers by default; consider giving the enum type an unsigned underlying type to make this code portable [-Werror,-Wsigned-enum-bitfield]
        align(align::none),
        ^

There were more instances than the above, but this gives the idea.

From my perspective, users of fmt would normally consider it a system include, not a regular part of their codebase. So I suggest that for the target_include_directories() in fmt/CMakeLists.txt, the SYSTEM cmake attribute be used, or at least a CMake OPTION be available to do so.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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