Reputation: 35408
In our C project which is managed by autotools we have the following (high level) directory structure:
<project>
+--- configure.ac 1024 bytes
+--- Makefile.am 1024 bytes
+--- include <DIR>
+--- Makefile.am 1023 bytes
+---source <DIR>
+--- Makefile.am 1022 bytes
+--- 3rdparty <DIR>
+--- Makefile.am 1021 bytes
The 3rdparty directory contains source code which is not written by us, but regardless is compiled and linked into the main application. Unfortunately this directory contains a lot of compile time warnings, we don't want to fix.
How can I disable the warnings (with the -w
flag) for all source files in the 3rdparty and its sub-directories?
Upvotes: 1
Views: 185
Reputation: 5300
@fritzone, to disable warnings in a third-party project is difficult. To ignore those warnings while using much stricter compiler flags in your own project can be done like this:
https://github.com/rubicks/autotool-subdirs
tldr; 3rdparty/Makefile.am
uses default warnings; src/Makefile.am
uses really strict warnings (treated as errors) and uses -isystem
(rather than -I
) to add the 3rdparty
inclusion path.
The project should look familiar:
.
├── 3rdparty
│ ├── Makefile.am
│ ├── third.c
│ └── third.h
├── Makefile.am
├── autosub-top.h
├── configure.ac
├── include
│ ├── Makefile.am
│ └── autosub.h
└── src
├── Makefile.am
├── autosub.c
└── prog.c
3rdparty/third.h
contains warn-able stuff like
static const size_t answer = -42;
which is included by src/autosub.c
. src/Makefile.am
compiles src/autosub.c
with
AM_CFLAGS = \
-Wall \
-Wconversion \
-Werror \
-Wextra \
-pedantic-errors \
-std=c99
and links in libthird.la
Upvotes: 1