diff --git a/src/libs/utils/environment.cpp b/src/libs/utils/environment.cpp index 41d28dcede2..20f822f38ce 100644 --- a/src/libs/utils/environment.cpp +++ b/src/libs/utils/environment.cpp @@ -174,21 +174,6 @@ void Environment::prependOrSetPath(const QString &value) prependOrSet(QLatin1String("PATH"), QDir::toNativeSeparators(value), QString(sep)); } -void Environment::prependOrSetLibrarySearchPath(const QString &value) -{ -#ifdef Q_OS_MAC - // we could set DYLD_LIBRARY_PATH on Mac but it is unnecessary in practice -#elif Q_OS_WIN - const QChar sep = QLatin1Char(';'); - const QLatin1String path("PATH"); - prependOrSet(path, QDir::toNativeSeparators(value), QString(sep)); -#elif Q_OS_UNIX - const QChar sep = QLatin1Char(':'); - const QLatin1String path("LD_LIBRARY_PATH"); - prependOrSet(path, QDir::toNativeSeparators(value), QString(sep)); -#endif -} - Environment Environment::systemEnvironment() { return Environment(QProcess::systemEnvironment()); diff --git a/src/libs/utils/environment.h b/src/libs/utils/environment.h index 4c9a0792edc..a2a0bf8a06d 100644 --- a/src/libs/utils/environment.h +++ b/src/libs/utils/environment.h @@ -85,8 +85,6 @@ public: void appendOrSetPath(const QString &value); void prependOrSetPath(const QString &value); - void prependOrSetLibrarySearchPath(const QString &value); - void clear(); int size() const; diff --git a/src/plugins/qt4projectmanager/qt-desktop/qt4runconfiguration.cpp b/src/plugins/qt4projectmanager/qt-desktop/qt4runconfiguration.cpp index f524212b100..28e6ac04ade 100644 --- a/src/plugins/qt4projectmanager/qt-desktop/qt4runconfiguration.cpp +++ b/src/plugins/qt4projectmanager/qt-desktop/qt4runconfiguration.cpp @@ -602,11 +602,16 @@ Utils::Environment Qt4RunConfiguration::baseEnvironment() const // The user could be linking to a library found via a -L/some/dir switch // to find those libraries while actually running we explicitly prepend those - // dirs to the library search path + // dirs to the library search path on windows/linux const Qt4ProFileNode *node = qt4Target()->qt4Project()->rootProjectNode()->findProFileFor(m_proFilePath); + const ProjectExplorer::Abi runAbi = abi(); if (node) - foreach(const QString &dir, node->variableValue(LibDirectoriesVar)) - env.prependOrSetLibrarySearchPath(dir); + foreach (const QString &dir, node->variableValue(LibDirectoriesVar)) { + if (runAbi.os() == ProjectExplorer::Abi::WindowsOS) + env.prependOrSetPath(dir); + else if (runAbi.osFlavor() == ProjectExplorer::Abi::GenericLinuxFlavor) + env.prependOrSet(QLatin1String("LD_LIBRARY_PATH"), dir, QLatin1String(":")); + } return env; } diff --git a/src/plugins/qt4projectmanager/qtversionmanager.cpp b/src/plugins/qt4projectmanager/qtversionmanager.cpp index 4bd0d55b758..66c448ed753 100644 --- a/src/plugins/qt4projectmanager/qtversionmanager.cpp +++ b/src/plugins/qt4projectmanager/qtversionmanager.cpp @@ -1722,7 +1722,14 @@ void QtVersion::addToEnvironment(Utils::Environment &env) const // Generic: env.set("QTDIR", QDir::toNativeSeparators(versionInfo().value("QT_INSTALL_DATA"))); env.prependOrSetPath(versionInfo().value("QT_INSTALL_BINS")); - env.prependOrSetLibrarySearchPath(versionInfo().value("QT_INSTALL_LIBS")); + + // set LD_LIBRARY_PATH for generic linux + foreach (const ProjectExplorer::Abi &abi, qtAbis()) { + if (abi.osFlavor() == ProjectExplorer::Abi::GenericLinuxFlavor) { + env.prependOrSet(QLatin1String("LD_LIBRARY_PATH"), versionInfo().value("QT_INSTALL_LIBS"), QLatin1String(":")); + break; + } + } // Symbian specific: if (supportsTargetId(Constants::S60_DEVICE_TARGET_ID)