Skip to content

Mark headers as SYSTEM includes in CMake #82

@mattgodbolt

Description

@mattgodbolt

The include paths are set using:

    target_include_directories(pico_stdlib_headers INTERFACE include)

(e.g. in src/common/pico_stdlib/CMakeLists.txt)

As they're not marked as SYSTEM, enabling warnings (e.g. -Wall) will erroneously be tagged in the system headers.

pico-sdk/src/rp2040/hardware_regs/include/hardware/regs/addressmap.h:56:20: error: type qualifiers ignored on cast result type [-Werror=ignored-qualifiers]
   56 | #define TIMER_BASE 0x40054000

for example. If the headers are tagged SYSTEM then CMake uses -Isystem or equivalent which tells the compiler to suppress warnings coming from those includes.

A potential fix is:

$ git grep -l target_include_directories | xargs perl -pi -e 's/target_include_directories(.*)INTERFACE/target_include_directories$1SYSTEM INTERFACE/'

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions