Fix AddLibraryDialog when selecting the lib from different drive

Omit PWD when trying to generate it for absolute path.

Task-number: QTCREATORBUG-16688
Task-number: QTCREATORBUG-8413
Task-number: QTCREATORBUG-15732
Change-Id: Ief318db1249662f4c9e69a8f8c401543a8f3120a
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Reviewed-by: Robert Loehning <robert.loehning@qt.io>
This commit is contained in:
Jarek Kobus
2016-08-08 17:42:32 +02:00
committed by Jarek Kobus
parent 02937fdc4b
commit 0b58d7435e

View File

@@ -428,8 +428,12 @@ static QString generateLibsSnippet(AddLibraryWizard::Platforms platforms,
const QString &targetRelativePath, const QString &pwd, const QString &targetRelativePath, const QString &pwd,
bool useSubfolders, bool addSuffix, bool generateLibPath) bool useSubfolders, bool addSuffix, bool generateLibPath)
{ {
// it contains: $$[pwd]/ const QDir targetRelativeDir(targetRelativePath);
const QString libraryPathSnippet = QLatin1String("$$") + pwd + QLatin1Char('/'); QString libraryPathSnippet;
if (targetRelativeDir.isRelative()) {
// it contains: $$[pwd]/
libraryPathSnippet = QLatin1String("$$") + pwd + QLatin1Char('/');
}
AddLibraryWizard::Platforms commonPlatforms = platforms; AddLibraryWizard::Platforms commonPlatforms = platforms;
if (macLibraryType == AddLibraryWizard::FrameworkType) // we will generate a separate -F -framework line if (macLibraryType == AddLibraryWizard::FrameworkType) // we will generate a separate -F -framework line
@@ -494,10 +498,15 @@ static QString generateLibsSnippet(AddLibraryWizard::Platforms platforms,
static QString generateIncludePathSnippet(const QString &includeRelativePath) static QString generateIncludePathSnippet(const QString &includeRelativePath)
{ {
return QLatin1String("\nINCLUDEPATH += $$PWD/") const QDir includeRelativeDir(includeRelativePath);
+ smartQuote(includeRelativePath) + QLatin1Char('\n') QString includePathSnippet;
+ QLatin1String("DEPENDPATH += $$PWD/") if (includeRelativeDir.isRelative()) {
+ smartQuote(includeRelativePath) + QLatin1Char('\n'); includePathSnippet = QLatin1String("$$PWD/");
}
includePathSnippet += smartQuote(includeRelativePath) + QLatin1Char('\n');
return QLatin1String("\nINCLUDEPATH += ") + includePathSnippet
+ QLatin1String("DEPENDPATH += ") + includePathSnippet;
} }
static QString generatePreTargetDepsSnippet(AddLibraryWizard::Platforms platforms, static QString generatePreTargetDepsSnippet(AddLibraryWizard::Platforms platforms,
@@ -509,9 +518,13 @@ static QString generatePreTargetDepsSnippet(AddLibraryWizard::Platforms platform
if (linkageType != AddLibraryWizard::StaticLinkage) if (linkageType != AddLibraryWizard::StaticLinkage)
return QString(); return QString();
// it contains: PRE_TARGETDEPS += $$[pwd]/ const QDir targetRelativeDir(targetRelativePath);
const QString preTargetDepsSnippet = QLatin1String("PRE_TARGETDEPS += $$") +
pwd + QLatin1Char('/'); QString preTargetDepsSnippet = QLatin1String("PRE_TARGETDEPS += ");
if (targetRelativeDir.isRelative()) {
// it contains: PRE_TARGETDEPS += $$[pwd]/
preTargetDepsSnippet += QLatin1String("$$") + pwd + QLatin1Char('/');
}
QString snippetMessage; QString snippetMessage;
QTextStream str(&snippetMessage); QTextStream str(&snippetMessage);