cmake: check whether $QTDIR is set before attempting to use it

REVIEW: 112446
Do not restore the applicationVersion when saving QCoreApplication-managed data

Unlike the application name, organization etc., this field is not used by
QSettings or QDesktopServices or QStandardPaths, so it does not have to be
restored this way.

REVIEW: 112444