Examples: Fix CMake Unity (Jumbo) builds

Disambiguate variables and add some exclusions.

Pick-to: 6.5
Task-number: QTBUG-109394
Change-Id: Ie72b3caab9fd571c3fb6f7d8606584885bc09e66
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
This commit is contained in:
Friedemann Kleint 2023-01-30 14:37:56 +01:00
parent ddb94dd792
commit 93af309a70
6 changed files with 18 additions and 14 deletions

View File

@ -19,7 +19,7 @@
static CborConverter cborConverter;
static CborDiagnosticDumper cborDiagnosticDumper;
static const char optionHelp[] =
static const char cborOptionHelp[] =
"convert-float-to-int=yes|no Write integers instead of floating point, if no\n"
" loss of precision occurs on conversion.\n"
"float16=yes|always|no Write using half-precision floating point.\n"
@ -207,7 +207,7 @@ Converter::Options CborConverter::outputOptions()
const char *CborConverter::optionsHelp()
{
return optionHelp;
return cborOptionHelp;
}
bool CborConverter::probeFile(QIODevice *f)
@ -314,7 +314,7 @@ void CborConverter::saveFile(QIODevice *f, const QVariant &contents, const QStri
}
fprintf(stderr, "Unknown CBOR format option '%s'. Valid options are:\n%s",
qPrintable(s), optionHelp);
qPrintable(s), cborOptionHelp);
exit(EXIT_FAILURE);
}
//! [4]

View File

@ -7,7 +7,7 @@
#include <QDebug>
#include <QTextStream>
static const char optionHelp[] =
static const char dataStreamOptionHelp[] =
"byteorder=host|big|little Byte order to use.\n"
"version=<n> QDataStream version (default: Qt 5.0).\n"
;
@ -143,7 +143,7 @@ Converter::Options DataStreamConverter::outputOptions()
const char *DataStreamConverter::optionsHelp()
{
return optionHelp;
return dataStreamOptionHelp;
}
bool DataStreamConverter::probeFile(QIODevice *f)
@ -209,7 +209,7 @@ void DataStreamConverter::saveFile(QIODevice *f, const QVariant &contents, const
}
fprintf(stderr, "Unknown QDataStream formatting option '%s'. Available options are:\n%s",
qPrintable(option), optionHelp);
qPrintable(option), dataStreamOptionHelp);
exit(EXIT_FAILURE);
}

View File

@ -11,7 +11,7 @@
static JsonConverter jsonConverter;
static const char optionHelp[] =
static const char jsonOptionHelp[] =
"compact=no|yes Use compact JSON form.\n";
static QJsonDocument convertFromVariant(const QVariant &v)
@ -45,7 +45,7 @@ Converter::Options JsonConverter::outputOptions()
const char *JsonConverter::optionsHelp()
{
return optionHelp;
return jsonOptionHelp;
}
bool JsonConverter::probeFile(QIODevice *f)
@ -96,7 +96,8 @@ void JsonConverter::saveFile(QIODevice *f, const QVariant &contents, const QStri
} else if (s == QLatin1String("compact=yes")) {
format = QJsonDocument::Compact;
} else {
fprintf(stderr, "Unknown option '%s' to JSON output. Valid options are:\n%s", qPrintable(s), optionHelp);
fprintf(stderr, "Unknown option '%s' to JSON output. Valid options are:\n%s",
qPrintable(s), jsonOptionHelp);
exit(EXIT_FAILURE);
}
}

View File

@ -13,7 +13,7 @@
#include <QXmlStreamReader>
#include <QXmlStreamWriter>
static const char optionHelp[] =
static const char xmlOptionHelp[] =
"compact=no|yes Use compact XML form.\n";
static XmlConverter xmlConverter;
@ -416,7 +416,7 @@ Converter::Options XmlConverter::outputOptions()
const char *XmlConverter::optionsHelp()
{
return optionHelp;
return xmlOptionHelp;
}
bool XmlConverter::probeFile(QIODevice *f)
@ -454,7 +454,8 @@ void XmlConverter::saveFile(QIODevice *f, const QVariant &contents, const QStrin
} else if (s == QLatin1String("compact=yes")) {
compact = true;
} else {
fprintf(stderr, "Unknown option '%s' to XML output. Valid options are:\n%s", qPrintable(s), optionHelp);
fprintf(stderr, "Unknown option '%s' to XML output. Valid options are:\n%s",
qPrintable(s), xmlOptionHelp);
exit(EXIT_FAILURE);
}
}

View File

@ -10,7 +10,7 @@ static const int PendingRequestTimeout = 60 * 1000;
static const int ClientTimeout = 120 * 1000;
static const int ConnectTimeout = 60 * 1000;
static const int KeepAliveInterval = 30 * 1000;
static const int RateControlTimerDelay = 2000;
static const int PeerRateControlTimerDelay = 2000;
static const int MinimalHeaderSize = 48;
static const char ProtocolId[] = "BitTorrent protocol";
static const char ProtocolIdSize = 19;
@ -45,7 +45,7 @@ PeerWireClient::PeerWireClient(const QByteArray &peerId, QObject *parent)
memset(uploadSpeedData, 0, sizeof(uploadSpeedData));
memset(downloadSpeedData, 0, sizeof(downloadSpeedData));
transferSpeedTimer = startTimer(RateControlTimerDelay);
transferSpeedTimer = startTimer(PeerRateControlTimerDelay);
timeoutTimer = startTimer(ConnectTimeout);
peerIdString = peerId;

View File

@ -11,6 +11,8 @@ target_sources(painting_shared PRIVATE
${moc_files}
)
set_target_properties(painting_shared PROPERTIES UNITY_BUILD OFF)
target_link_libraries(painting_shared PUBLIC Qt6::Widgets)
target_include_directories(painting_shared PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}")