-Wundef is not being ignored with pragma in g++
What I've done before when third party headers were inducing warnings was to wrap them in my own private header that uses #pragma GCC system_header
to just silence all the warnings from that header. I use my own wrapper to keep the includes neat and allow for an additional customization point in the future if needed.