diff options
author | Sebastian Holtermann <sebholt@xwmw.org> | 2017-11-19 11:44:21 (GMT) |
---|---|---|
committer | Sebastian Holtermann <sebholt@xwmw.org> | 2017-11-19 12:35:07 (GMT) |
commit | 4043463179d5e238cd1505f68fe0a4e75f4feba4 (patch) | |
tree | 04debfc27d4f85d6f36f3a01532f86c32dea0e18 /Source | |
parent | be11a85286ad538654dacce63a6be0af0c3c5bec (diff) | |
download | CMake-4043463179d5e238cd1505f68fe0a4e75f4feba4.zip CMake-4043463179d5e238cd1505f68fe0a4e75f4feba4.tar.gz CMake-4043463179d5e238cd1505f68fe0a4e75f4feba4.tar.bz2 |
Autogen: Use integers instead of strings for the Qt version
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmQtAutoGeneratorInitializer.cxx | 3 | ||||
-rw-r--r-- | Source/cmQtAutoGeneratorMocUic.cxx | 19 | ||||
-rw-r--r-- | Source/cmQtAutoGeneratorMocUic.h | 3 |
3 files changed, 9 insertions, 16 deletions
diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx index a2c9b42..d9a5a9a 100644 --- a/Source/cmQtAutoGeneratorInitializer.cxx +++ b/Source/cmQtAutoGeneratorInitializer.cxx @@ -899,10 +899,9 @@ void cmQtAutoGeneratorInitializer::SetupCustomTargets() AddDefinitionEscaped(makefile, "_multi_config", cmQtAutoGen::MultiConfigName(this->MultiConfig)); AddDefinitionEscaped(makefile, "_build_dir", this->DirBuild); - AddDefinitionEscaped(makefile, "_qt_version_major", this->QtVersionMajor); - AddDefinitionEscaped(makefile, "_qt_version_minor", this->QtVersionMinor); if (this->MocEnabled || this->UicEnabled) { + AddDefinitionEscaped(makefile, "_qt_version_major", this->QtVersionMajor); AddDefinitionEscaped(makefile, "_settings_file", this->AutogenSettingsFile); AddDefinitionEscaped(makefile, "_sources", this->Sources); diff --git a/Source/cmQtAutoGeneratorMocUic.cxx b/Source/cmQtAutoGeneratorMocUic.cxx index 1956a89..0de02b5 100644 --- a/Source/cmQtAutoGeneratorMocUic.cxx +++ b/Source/cmQtAutoGeneratorMocUic.cxx @@ -49,6 +49,7 @@ static bool ListContains(std::vector<std::string> const& list, cmQtAutoGeneratorMocUic::cmQtAutoGeneratorMocUic() : MultiConfig(cmQtAutoGen::WRAP) , IncludeProjectDirsBefore(false) + , QtVersionMajor(4) , MocSettingsChanged(false) , MocPredefsChanged(false) , MocRelaxedMode(false) @@ -163,19 +164,13 @@ bool cmQtAutoGeneratorMocUic::InitInfoFile(cmMakefile* makefile) } // - Qt environment - this->QtMajorVersion = InfoGet("AM_QT_VERSION_MAJOR"); - this->QtMinorVersion = InfoGet("AM_QT_VERSION_MINOR"); + if (!cmSystemTools::StringToULong(InfoGet("AM_QT_VERSION_MAJOR"), + &this->QtVersionMajor)) { + this->QtVersionMajor = 4; + } this->MocExecutable = InfoGet("AM_QT_MOC_EXECUTABLE"); this->UicExecutable = InfoGet("AM_QT_UIC_EXECUTABLE"); - // Check Qt version - if ((this->QtMajorVersion != "4") && (this->QtMajorVersion != "5")) { - this->LogFileError(cmQtAutoGen::GEN, this->GetInfoFile(), - "Unsupported Qt version: " + - cmQtAutoGen::Quoted(this->QtMajorVersion)); - return false; - } - // - Moc if (this->MocEnabled()) { this->MocSkipList = InfoGetList("AM_MOC_SKIP"); @@ -203,7 +198,7 @@ bool cmQtAutoGeneratorMocUic::InitInfoFile(cmMakefile* makefile) std::vector<std::string> const mocDependFilters = InfoGetList("AM_MOC_DEPEND_FILTERS"); // Insert Q_PLUGIN_METADATA dependency filter - if (this->QtMajorVersion != "4") { + if (this->QtVersionMajor != 4) { this->MocDependFilterPush("Q_PLUGIN_METADATA", "[\n][ \t]*Q_PLUGIN_METADATA[ \t]*\\(" "[^\\)]*FILE[ \t]*\"([^\"]+)\""); @@ -1686,7 +1681,7 @@ bool cmQtAutoGeneratorMocUic::UicGenerateFile(const UicJob& uicJob) auto optionIt = this->UicOptions.find(uicJob.SourceFile); if (optionIt != this->UicOptions.end()) { cmQtAutoGen::UicMergeOptions(allOpts, optionIt->second, - (this->QtMajorVersion == "5")); + (this->QtVersionMajor == 5)); } cmd.insert(cmd.end(), allOpts.begin(), allOpts.end()); } diff --git a/Source/cmQtAutoGeneratorMocUic.h b/Source/cmQtAutoGeneratorMocUic.h index a03270b..d510939 100644 --- a/Source/cmQtAutoGeneratorMocUic.h +++ b/Source/cmQtAutoGeneratorMocUic.h @@ -154,8 +154,7 @@ private: std::string AutogenBuildDir; std::string AutogenIncludeDir; // -- Qt environment - std::string QtMajorVersion; - std::string QtMinorVersion; + unsigned long QtVersionMajor; std::string MocExecutable; std::string UicExecutable; // -- File lists |