Moved it out of CXXFLAGS and into the command-line for the GUI objects. It will no longer be invoked for non-GUI and crypto object files.
Also changed wx-config --cppflags to --cxxflags. I am not sure what the difference is supposed to be, but --cppflags does not include -pthread.