jeudi 6 juillet 2023

How to ignore "-W" message on included third party libraries?

I often include external/third party libraries on my C++ projects, and almost everytime they contains -W warning message while compiling my code.

They are located on lib/* folders. Specifically on Makefile, that's what I include:

# Add .h and .hpp to the preprocessor build
HEADERS += $(wildcard lib/*.h)
HEADERS += $(wildcard lib/*.hpp)
HEADERS += $(wildcard lib/**/*.h)
HEADERS += $(wildcard lib/**/*.hpp)
HEADERS += $(wildcard lib/**/**/*.h)
HEADERS += $(wildcard lib/**/**/*.hpp)
HEADERS += $(wildcard src/*.h)
HEADERS += $(wildcard src/*.hpp)
HEADERS += $(wildcard src/**/*.h)
HEADERS += $(wildcard src/**/*.hpp)

# Add .c and .cpp files to the build
SOURCES += $(wildcard lib/*.c)
SOURCES += $(wildcard lib/*.cpp)
SOURCES += $(wildcard lib/**/*.c)
SOURCES += $(wildcard lib/**/*.cpp)
SOURCES += $(wildcard lib/**/**/*.c)
SOURCES += $(wildcard lib/**/**/*.cpp)
SOURCES += $(wildcard src/*.c)
SOURCES += $(wildcard src/*.cpp)
SOURCES += $(wildcard src/**/*.c)
SOURCES += $(wildcard src/**/*.cpp)

# FLAGS will be passed to both the C and C++ compiler
FLAGS +=
CFLAGS +=
CXXFLAGS += $(sort $(foreach HEADERS, $(HEADERS), -I$(dir $(HEADERS))))

Is it possible to specify (I'm using MingGW on Windows, so "gcc") that for that lib/* folder, ignore warning message? Keeping my code/compilation clean? Its pretty boring "mess" with others libraries warning why compiling and check status.

Aucun commentaire:

Enregistrer un commentaire