Add CPPFLAGS handling properly

Before the implementation wasn't complete, which is why it got removed
in the first place. This adds it back properly.