diff options
author | Ivan Komissarov <abbapoh@gmail.com> | 2021-10-21 23:49:01 +0300 |
---|---|---|
committer | Ivan Komissarov <ABBAPOH@gmail.com> | 2021-10-26 10:12:57 +0000 |
commit | 24044d6da5d3f3725adc134fdb7e71fe398381ff (patch) | |
tree | b612900d1390ed0e0bf80a0267cd2d7d7b175f35 /src/lib | |
parent | 6812665a5e4de5b974b56d12d0bf6b7db19c58a3 (diff) |
Split libDirs and extraPaths variables
pkg-config has 2 different variables - PKG_CONFIG_LIBDIR overrides the
default search paths and PKG_CONFIG_PATH prepends paths to the default
paths or paths set via PKG_CONFIG_LIBDIR.
Change-Id: I8f67b7bbae9325b17abb20ec5eb8d037626c8089
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/corelib/jsextensions/pkgconfigjs.cpp | 6 | ||||
-rw-r--r-- | src/lib/pkgconfig/pkgconfig.cpp | 9 | ||||
-rw-r--r-- | src/lib/pkgconfig/pkgconfig.h | 3 |
3 files changed, 12 insertions, 6 deletions
diff --git a/src/lib/corelib/jsextensions/pkgconfigjs.cpp b/src/lib/corelib/jsextensions/pkgconfigjs.cpp index 2bd7b5d17..3bace6f06 100644 --- a/src/lib/corelib/jsextensions/pkgconfigjs.cpp +++ b/src/lib/corelib/jsextensions/pkgconfigjs.cpp @@ -218,8 +218,10 @@ PkgConfigJs::PkgConfigJs( PkgConfig::Options PkgConfigJs::convertOptions(const QProcessEnvironment &env, const QVariantMap &map) { PkgConfig::Options result; - result.searchPaths = - stringListToStdVector(map.value(QStringLiteral("searchPaths")).toStringList()); + result.libDirs = + stringListToStdVector(map.value(QStringLiteral("libDirs")).toStringList()); + result.extraPaths = + stringListToStdVector(map.value(QStringLiteral("extraPaths")).toStringList()); result.sysroot = map.value(QStringLiteral("sysroot")).toString().toStdString(); result.topBuildDir = map.value(QStringLiteral("topBuildDir")).toString().toStdString(); result.allowSystemLibraryPaths = diff --git a/src/lib/pkgconfig/pkgconfig.cpp b/src/lib/pkgconfig/pkgconfig.cpp index 8a3c81c64..f017b365c 100644 --- a/src/lib/pkgconfig/pkgconfig.cpp +++ b/src/lib/pkgconfig/pkgconfig.cpp @@ -176,8 +176,8 @@ PkgConfig::PkgConfig() PkgConfig::PkgConfig(Options options) : m_options(std::move(options)) { - if (m_options.searchPaths.empty()) - m_options.searchPaths = split(PKG_CONFIG_PC_PATH, listSeparator()); + if (m_options.libDirs.empty()) + m_options.libDirs = split(PKG_CONFIG_PC_PATH, listSeparator()); if (m_options.topBuildDir.empty()) m_options.topBuildDir = "$(top_builddir)"; // pkg-config sets this for automake =) @@ -452,7 +452,10 @@ PkgConfig::Packages PkgConfig::findPackages() const m_options.systemLibraryPaths.begin(), m_options.systemLibraryPaths.end()) : std::unordered_set<std::string>(); - const auto pcFilePaths = getPcFilePaths(m_options.searchPaths); + auto allSearchPaths = m_options.extraPaths; + allSearchPaths.insert( + allSearchPaths.end(), m_options.libDirs.begin(), m_options.libDirs.end()); + const auto pcFilePaths = getPcFilePaths(allSearchPaths); for (const auto &pcFilePath : pcFilePaths) { if (m_options.disableUninstalled) { diff --git a/src/lib/pkgconfig/pkgconfig.h b/src/lib/pkgconfig/pkgconfig.h index 76e4a3ac3..6da1f053f 100644 --- a/src/lib/pkgconfig/pkgconfig.h +++ b/src/lib/pkgconfig/pkgconfig.h @@ -50,7 +50,8 @@ public: struct Options { using VariablesMap = PcPackage::VariablesMap; - std::vector<std::string> searchPaths; // PKG_CONFIG_PATH, PKG_CONFIG_LIBDIR + std::vector<std::string> libDirs; // PKG_CONFIG_LIBDIR + std::vector<std::string> extraPaths; // PKG_CONFIG_PATH std::string sysroot; // PKG_CONFIG_SYSROOT_DIR std::string topBuildDir; // PKG_CONFIG_TOP_BUILD_DIR bool allowSystemLibraryPaths{false}; // PKG_CONFIG_ALLOW_SYSTEM_LIBS |