diff options
author | Joerg Bornemann <joerg.bornemann@digia.com> | 2014-10-21 11:47:16 (GMT) |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@theqtcompany.com> | 2014-10-27 09:00:44 (GMT) |
commit | d75e9ba08ae0e2c71812c0e5b157a2f93c8eedfd (patch) | |
tree | f4b119b3b9ba47b367155e39948cecf44c9e231c /qmake | |
parent | 08ffa4bc83b0d43ee15023713438e16b4e984b61 (diff) | |
download | Qt-d75e9ba08ae0e2c71812c0e5b157a2f93c8eedfd.zip Qt-d75e9ba08ae0e2c71812c0e5b157a2f93c8eedfd.tar.gz Qt-d75e9ba08ae0e2c71812c0e5b157a2f93c8eedfd.tar.bz2 |
qmake vcxproj generator: write PrimaryOutputExtension value
Second attempt. MSVCPROJ_TARGET contains the resolved target name,
including version number and target extension.
We're splitting this value into PrimaryOutput and
PrimaryOutputExtension.
PrimaryOutputExtension is only written if it contains a non-default
value.
Task-number: QTBUG-26782
Change-Id: I4b828dc5dd47322f653585aee1a5767f0cf8bd48
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
(cherry picked from commit qtbase/d1e950b919615c1ae754e07899f1b45303c17654)
Reviewed-by: Andy Shaw <andy.shaw@digia.com>
Diffstat (limited to 'qmake')
-rw-r--r-- | qmake/generators/win32/msbuild_objectmodel.cpp | 12 | ||||
-rw-r--r-- | qmake/generators/win32/msvc_objectmodel.h | 1 | ||||
-rw-r--r-- | qmake/generators/win32/msvc_vcproj.cpp | 27 | ||||
-rw-r--r-- | qmake/generators/win32/msvc_vcproj.h | 1 |
4 files changed, 33 insertions, 8 deletions
diff --git a/qmake/generators/win32/msbuild_objectmodel.cpp b/qmake/generators/win32/msbuild_objectmodel.cpp index a6b6dcf..a5e2725 100644 --- a/qmake/generators/win32/msbuild_objectmodel.cpp +++ b/qmake/generators/win32/msbuild_objectmodel.cpp @@ -456,7 +456,11 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProjectSingleConfig &tool) << attrTag("Condition", condition) << valueTag(tool.Configuration.PrimaryOutput); } - + if (!tool.Configuration.PrimaryOutputExtension.isEmpty()) { + xml<< tag("TargetExt") + << attrTag("Condition", condition) + << valueTag(tool.Configuration.PrimaryOutputExtension); + } if ( tool.Configuration.linker.IgnoreImportLibrary != unset) { xml<< tag("IgnoreImportLibrary") << attrTag("Condition", condition) @@ -651,7 +655,11 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProject &tool) << attrTag("Condition", condition) << valueTag(config.PrimaryOutput); } - + if (!config.PrimaryOutputExtension.isEmpty()) { + xml << tag("TargetExt") + << attrTag("Condition", condition) + << valueTag(config.PrimaryOutputExtension); + } if (config.linker.IgnoreImportLibrary != unset) { xml << tag("IgnoreImportLibrary") << attrTag("Condition", condition) diff --git a/qmake/generators/win32/msvc_objectmodel.h b/qmake/generators/win32/msvc_objectmodel.h index 9372ed3..f67c0ca 100644 --- a/qmake/generators/win32/msvc_objectmodel.h +++ b/qmake/generators/win32/msvc_objectmodel.h @@ -862,6 +862,7 @@ public: QString ConfigurationName; QString OutputDirectory; QString PrimaryOutput; + QString PrimaryOutputExtension; QString ProgramDatabase; triState RegisterOutput; useOfATL UseOfATL; diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index c13ca4c..765f5fb 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -375,6 +375,21 @@ QUuid VcprojGenerator::increaseUUID(const QUuid &id) return result; } +bool VcprojGenerator::isStandardSuffix(const QString &suffix) const +{ + if (!project->values("QMAKE_APP_FLAG").isEmpty()) { + if (suffix.compare("exe", Qt::CaseInsensitive) == 0) + return true; + } else if (project->isActiveConfig("shared")) { + if (suffix.compare("dll", Qt::CaseInsensitive) == 0) + return true; + } else { + if (suffix.compare("lib", Qt::CaseInsensitive) == 0) + return true; + } + return false; +} + QStringList VcprojGenerator::collectSubDirs(QMakeProject *proj) { QStringList subdirs; @@ -917,12 +932,12 @@ void VcprojGenerator::initConfiguration() if (!conf.OutputDirectory.endsWith("\\")) conf.OutputDirectory += '\\'; if (conf.CompilerVersion >= NET2010) { - // The target name could have been changed. - conf.PrimaryOutput = project->first("TARGET"); - if (!conf.PrimaryOutput.isEmpty() && project->first("TEMPLATE") == "vclib" - && project->isActiveConfig("shared")) { - conf.PrimaryOutput.append(project->first("TARGET_VERSION_EXT")); - } + const QFileInfo targetInfo = fileInfo(project->first("MSVCPROJ_TARGET")); + conf.PrimaryOutput = targetInfo.completeBaseName(); + + const QString targetSuffix = targetInfo.suffix(); + if (!isStandardSuffix(targetSuffix)) + conf.PrimaryOutputExtension = '.' + targetSuffix; } conf.Name = project->values("BUILD_NAME").join(" "); diff --git a/qmake/generators/win32/msvc_vcproj.h b/qmake/generators/win32/msvc_vcproj.h index 06a7ca4..4b693c0 100644 --- a/qmake/generators/win32/msvc_vcproj.h +++ b/qmake/generators/win32/msvc_vcproj.h @@ -134,6 +134,7 @@ protected: private: QStringList collectSubDirs(QMakeProject *proj); QUuid increaseUUID(const QUuid &id); + bool isStandardSuffix(const QString &suffix) const; friend class VCFilter; }; |