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>
This commit is contained in:
parent
1ff6c575ce
commit
d1e950b919
@ -474,7 +474,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)
|
||||
@ -696,7 +700,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)
|
||||
|
@ -887,6 +887,7 @@ public:
|
||||
QString ConfigurationName;
|
||||
QString OutputDirectory;
|
||||
QString PrimaryOutput;
|
||||
QString PrimaryOutputExtension;
|
||||
QString ProgramDatabase;
|
||||
QString PlatformToolSet;
|
||||
triState RegisterOutput;
|
||||
|
@ -405,6 +405,21 @@ QString VcprojGenerator::retrievePlatformToolSet() const
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
ProStringList VcprojGenerator::collectDependencies(QMakeProject *proj, QHash<QString, QString> &projLookup,
|
||||
QHash<QString, QString> &projGuids,
|
||||
QHash<VcsolutionDepend *, QStringList> &extraSubdirs,
|
||||
@ -993,12 +1008,12 @@ void VcprojGenerator::initConfiguration()
|
||||
if (conf.CompilerVersion >= NET2010) {
|
||||
conf.PlatformToolSet = retrievePlatformToolSet();
|
||||
|
||||
// The target name could have been changed.
|
||||
conf.PrimaryOutput = project->first("TARGET").toQString();
|
||||
if (!conf.PrimaryOutput.isEmpty() && project->first("TEMPLATE") == "vclib"
|
||||
&& project->isActiveConfig("shared")) {
|
||||
conf.PrimaryOutput.append(project->first("TARGET_VERSION_EXT").toQString());
|
||||
}
|
||||
const QFileInfo targetInfo = fileInfo(project->first("MSVCPROJ_TARGET").toQString());
|
||||
conf.PrimaryOutput = targetInfo.completeBaseName();
|
||||
|
||||
const QString targetSuffix = targetInfo.suffix();
|
||||
if (!isStandardSuffix(targetSuffix))
|
||||
conf.PrimaryOutputExtension = '.' + targetSuffix;
|
||||
}
|
||||
|
||||
if (conf.CompilerVersion >= NET2012) {
|
||||
|
@ -137,6 +137,7 @@ private:
|
||||
const ProStringList &allDependencies = ProStringList());
|
||||
QUuid increaseUUID(const QUuid &id);
|
||||
QString retrievePlatformToolSet() const;
|
||||
bool isStandardSuffix(const QString &suffix) const;
|
||||
friend class VCFilter;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user