diff options
Diffstat (limited to 'qmake/generators')
-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; }; |