forked from qt-creator/qt-creator
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:
@@ -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)
|
||||||
{
|
{
|
||||||
|
const QDir targetRelativeDir(targetRelativePath);
|
||||||
|
QString libraryPathSnippet;
|
||||||
|
if (targetRelativeDir.isRelative()) {
|
||||||
// it contains: $$[pwd]/
|
// it contains: $$[pwd]/
|
||||||
const QString libraryPathSnippet = QLatin1String("$$") + pwd + QLatin1Char('/');
|
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();
|
||||||
|
|
||||||
|
const QDir targetRelativeDir(targetRelativePath);
|
||||||
|
|
||||||
|
QString preTargetDepsSnippet = QLatin1String("PRE_TARGETDEPS += ");
|
||||||
|
if (targetRelativeDir.isRelative()) {
|
||||||
// it contains: PRE_TARGETDEPS += $$[pwd]/
|
// it contains: PRE_TARGETDEPS += $$[pwd]/
|
||||||
const QString preTargetDepsSnippet = QLatin1String("PRE_TARGETDEPS += $$") +
|
preTargetDepsSnippet += QLatin1String("$$") + pwd + QLatin1Char('/');
|
||||||
pwd + QLatin1Char('/');
|
}
|
||||||
|
|
||||||
QString snippetMessage;
|
QString snippetMessage;
|
||||||
QTextStream str(&snippetMessage);
|
QTextStream str(&snippetMessage);
|
||||||
|
|||||||
Reference in New Issue
Block a user