summaryrefslogtreecommitdiff
path: root/Source/cmQtAutoGen.cxx
diff options
context:
space:
mode:
authorCraig Scott <craig.scott@crascit.com>2021-10-04 14:04:51 +1100
committerCraig Scott <craig.scott@crascit.com>2021-10-05 23:29:16 +1100
commit2a3116795528354b9e93238d057efa16b3635da8 (patch)
treeb664039635b2f9531f9a20080208436ac1a701e7 /Source/cmQtAutoGen.cxx
parenta31447417f65ac37c4a4966fc7314c40b3fca91b (diff)
downloadcmake-2a3116795528354b9e93238d057efa16b3635da8.tar.gz
AUTOUIC: Fix merging of --blah options not being detected for Qt6
When merging a new set of uic options with a base set of options, such as when a source file has a non-empty AUTOUIC_OPTIONS property, the test for whether to support options starting with two hyphens was only testing if the Qt major version was exactly 5 rather than at least 5. That had the effect of preventing such options from being merged correctly when using Qt6, so new and base options would both be present instead of the single merged option from the source file properties. Update the version check and rename function arguments to avoid misrepresenting what they mean. Note that uic accepts long option names with a single hyphen too. See Qt docs for QCommandLineParser::ParseAsLongOptions for confirmation.
Diffstat (limited to 'Source/cmQtAutoGen.cxx')
-rw-r--r--Source/cmQtAutoGen.cxx13
1 files changed, 7 insertions, 6 deletions
diff --git a/Source/cmQtAutoGen.cxx b/Source/cmQtAutoGen.cxx
index 57fcd2da76..9584e5c41a 100644
--- a/Source/cmQtAutoGen.cxx
+++ b/Source/cmQtAutoGen.cxx
@@ -24,7 +24,8 @@
/// @arg valueOpts list of options that accept a value
void MergeOptions(std::vector<std::string>& baseOpts,
std::vector<std::string> const& newOpts,
- std::initializer_list<cm::string_view> valueOpts, bool isQt5)
+ std::initializer_list<cm::string_view> valueOpts,
+ bool isQt5OrLater)
{
if (newOpts.empty()) {
return;
@@ -47,7 +48,7 @@ void MergeOptions(std::vector<std::string>& baseOpts,
auto oit = newOpt.begin();
if (*oit == '-') {
++oit;
- if (isQt5 && (*oit == '-')) {
+ if (isQt5OrLater && (*oit == '-')) {
++oit;
}
optName.assign(oit, newOpt.end());
@@ -204,24 +205,24 @@ std::string cmQtAutoGen::AppendFilenameSuffix(cm::string_view filename,
void cmQtAutoGen::UicMergeOptions(std::vector<std::string>& baseOpts,
std::vector<std::string> const& newOpts,
- bool isQt5)
+ bool isQt5OrLater)
{
static std::initializer_list<cm::string_view> const valueOpts = {
"tr", "translate", "postfix", "generator",
"include", // Since Qt 5.3
"g"
};
- MergeOptions(baseOpts, newOpts, valueOpts, isQt5);
+ MergeOptions(baseOpts, newOpts, valueOpts, isQt5OrLater);
}
void cmQtAutoGen::RccMergeOptions(std::vector<std::string>& baseOpts,
std::vector<std::string> const& newOpts,
- bool isQt5)
+ bool isQt5OrLater)
{
static std::initializer_list<cm::string_view> const valueOpts = {
"name", "root", "compress", "threshold"
};
- MergeOptions(baseOpts, newOpts, valueOpts, isQt5);
+ MergeOptions(baseOpts, newOpts, valueOpts, isQt5OrLater);
}
static void RccListParseContent(std::string const& content,