aboutsummaryrefslogtreecommitdiff
path: root/src/PkgConfig.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/PkgConfig.cpp')
-rw-r--r--src/PkgConfig.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/PkgConfig.cpp b/src/PkgConfig.cpp
index faed146..9efc238 100644
--- a/src/PkgConfig.cpp
+++ b/src/PkgConfig.cpp
@@ -4,12 +4,14 @@
using namespace std;
+static sibs::FileString pkgConfigPath = "pkg-config";
+
// TODO: Do not use pkg-config program. The same functionality can easily be achieved
// by reading files in /usr/share/pkgconfig
// Or is there no downside to calling pkg-config program?
namespace sibs
{
- string trimRight(const string &input)
+ static string trimRight(const string &input)
{
for(int i = input.size() - 1; i >= 0; --i)
{
@@ -18,6 +20,11 @@ namespace sibs
}
return "";
}
+
+ void PkgConfig::setPkgConfigPath(const FileString &path)
+ {
+ pkgConfigPath = path;
+ }
Result<bool> PkgConfig::validatePkgConfigPackageVersionExists(PackageListDependency *dependency)
{
@@ -34,7 +41,7 @@ namespace sibs
Result<bool> PkgConfig::validatePackageExists(const string &name)
{
- FileString command = TINYDIR_STRING("pkg-config --exists '");
+ FileString command = pkgConfigPath + TINYDIR_STRING(" --exists '");
command += toFileString(name);
command += TINYDIR_STRING("'");
Result<ExecResult> execResult = exec(command.c_str());
@@ -68,7 +75,7 @@ namespace sibs
// Use --modversion instead and check if the version returned is newer or equal to dependency version.
// This way we can output installed version vs expected dependency version
- FileString command = TINYDIR_STRING("pkg-config '--atleast-version=");
+ FileString command = pkgConfigPath + TINYDIR_STRING(" '--atleast-version=");
command += toFileString(version);
command += TINYDIR_STRING("' '");
command += toFileString(name);
@@ -111,7 +118,7 @@ namespace sibs
args += "'";
}
- FileString command = TINYDIR_STRING("pkg-config --libs");
+ FileString command = pkgConfigPath + TINYDIR_STRING(" --libs");
command += toFileString(args);
Result<ExecResult> execResult = exec(command.c_str());
if(execResult.isErr())
@@ -154,7 +161,7 @@ namespace sibs
args += "'";
}
- FileString command = TINYDIR_STRING("pkg-config --cflags");
+ FileString command = pkgConfigPath + TINYDIR_STRING(" --cflags");
command += toFileString(args);
Result<ExecResult> execResult = exec(command.c_str());
if(execResult.isErr())