summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorTobias Hunger <tobias.hunger@qt.io>2018-11-28 14:07:31 (GMT)
committerTobias Hunger <tobias.hunger@gmail.com>2019-01-07 13:13:10 (GMT)
commit9045f6a30fc8ce21d2b2298c27ba1da41c23bbf3 (patch)
tree776b38da996a97e82961e04893c1d090bd1683c4 /Source
parentc1e9b1c283caccd468adfafd0496edd63964b899 (diff)
downloadCMake-9045f6a30fc8ce21d2b2298c27ba1da41c23bbf3.zip
CMake-9045f6a30fc8ce21d2b2298c27ba1da41c23bbf3.tar.gz
CMake-9045f6a30fc8ce21d2b2298c27ba1da41c23bbf3.tar.bz2
Autogen: Prepare for Qt 6
Handle Qt version > 5 in Qt AutoGen. This patch does *NOT* include tests and documentation: There is no Qt 6 yet. I still need this patch to work on a cmake based build system for Qt 6.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmQtAutoGenGlobalInitializer.cxx3
-rw-r--r--Source/cmQtAutoGenInitializer.cxx17
2 files changed, 12 insertions, 8 deletions
diff --git a/Source/cmQtAutoGenGlobalInitializer.cxx b/Source/cmQtAutoGenGlobalInitializer.cxx
index 5470ec3..0ed8af4 100644
--- a/Source/cmQtAutoGenGlobalInitializer.cxx
+++ b/Source/cmQtAutoGenGlobalInitializer.cxx
@@ -77,7 +77,8 @@ cmQtAutoGenGlobalInitializer::cmQtAutoGenGlobalInitializer(
if (moc || uic || rcc) {
// We support Qt4 and Qt5
auto qtVersion = cmQtAutoGenInitializer::GetQtVersion(target);
- if ((qtVersion.Major == 4) || (qtVersion.Major == 5)) {
+ if ((qtVersion.Major == 4) || (qtVersion.Major == 5) ||
+ (qtVersion.Major == 6)) {
// Create autogen target initializer
Initializers_.emplace_back(cm::make_unique<cmQtAutoGenInitializer>(
this, target, qtVersion, moc, uic, rcc, globalAutoGenTarget,
diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx
index 6a2a951..ffa6a35 100644
--- a/Source/cmQtAutoGenInitializer.cxx
+++ b/Source/cmQtAutoGenInitializer.cxx
@@ -42,6 +42,9 @@
std::string GetQtExecutableTargetName(
const cmQtAutoGen::IntegerVersion& qtVersion, std::string const& executable)
{
+ if (qtVersion.Major == 6) {
+ return ("Qt6::" + executable);
+ }
if (qtVersion.Major == 5) {
return ("Qt5::" + executable);
}
@@ -504,7 +507,7 @@ bool cmQtAutoGenInitializer::InitMoc()
{
// We need to disable this until we have all implicit includes available.
// See issue #18669.
- // bool const appendImplicit = (this->QtVersion.Major == 5);
+ // bool const appendImplicit = (this->QtVersion.Major >= 5);
auto GetIncludeDirs =
[this, localGen](std::string const& cfg) -> std::vector<std::string> {
@@ -839,7 +842,7 @@ bool cmQtAutoGenInitializer::InitScanFiles()
// Process qrc files
if (!this->Rcc.Qrcs.empty()) {
- const bool QtV5 = (this->QtVersion.Major == 5);
+ const bool modernQt = (this->QtVersion.Major >= 5);
// Target rcc options
std::vector<std::string> optionsTarget;
cmSystemTools::ExpandListArgument(
@@ -911,10 +914,10 @@ bool cmQtAutoGenInitializer::InitScanFiles()
std::vector<std::string> nameOpts;
nameOpts.emplace_back("-name");
nameOpts.emplace_back(std::move(name));
- RccMergeOptions(opts, nameOpts, QtV5);
+ RccMergeOptions(opts, nameOpts, modernQt);
}
// Merge file option
- RccMergeOptions(opts, qrc.Options, QtV5);
+ RccMergeOptions(opts, qrc.Options, modernQt);
qrc.Options = std::move(opts);
}
// RCC resources
@@ -1374,7 +1377,7 @@ static std::vector<cmQtAutoGenInitializer::IntegerVersion> GetKnownQtVersions(
std::vector<cmQtAutoGenInitializer::IntegerVersion> result;
for (const std::string& prefix :
- std::vector<std::string>({ "Qt5Core", "QT" })) {
+ std::vector<std::string>({ "Qt6Core", "Qt5Core", "QT" })) {
auto tmp = cmQtAutoGenInitializer::IntegerVersion(
StringToInt(makefile->GetSafeDefinition(prefix + "_VERSION_MAJOR")),
StringToInt(makefile->GetSafeDefinition(prefix + "_VERSION_MINOR")));
@@ -1427,7 +1430,7 @@ std::pair<bool, std::string> GetQtExecutable(
GetQtExecutableTargetName(qtVersion, executable);
if (targetName.empty()) {
err = "The AUTOMOC, AUTOUIC and AUTORCC feature ";
- err += "supports only Qt 4 and Qt 5";
+ err += "supports only Qt 4, Qt 5 and Qt 6.";
} else {
cmLocalGenerator* localGen = target->GetLocalGenerator();
cmGeneratorTarget* tgt = localGen->FindGeneratorTargetToUse(targetName);
@@ -1510,7 +1513,7 @@ bool cmQtAutoGenInitializer::GetRccExecutable()
return false;
}
- if (this->QtVersion.Major == 5) {
+ if (this->QtVersion.Major == 5 || this->QtVersion.Major == 6) {
if (stdOut.find("--list") != std::string::npos) {
this->Rcc.ListOptions.push_back("--list");
} else {