It fails to build due to undefined references, probably not compiled in at some point. The breakage starts at line 890 of the included build.log.
Created attachment 376476 [details] included build log
It seems that it is checked for cups here but QtGui does not seem to use it, so this should not be a problem. Probably you are hitting bug #451456 according to the log. Can you please uninstall any previously installed Qt5 version and try to reinstall and see if the error is reproducible?
Yeah the real failure here is the undefined references at the end, cups has nothing to do with it.
Please try again with 5.3.0, this is probably fixed as per comment #2.
It compiles without CUPS fine.