diff options
4 files changed, 24 insertions, 0 deletions
diff --git a/doc/reference/modules/exporter-pkgconfig-module.qdoc b/doc/reference/modules/exporter-pkgconfig-module.qdoc index 29672fb21..9489b4622 100644 --- a/doc/reference/modules/exporter-pkgconfig-module.qdoc +++ b/doc/reference/modules/exporter-pkgconfig-module.qdoc @@ -196,3 +196,15 @@ \defaultvalue \c {product.version} */ + +/*! + \qmlproperty string Exporter.pkgconfig::customVariables + + Use this property to add arbitrary variable assignments into the \c .pc file. + The property is a map that will produce one assignment per entry. + The keys and values of the map represent the left-hand sides and right-hand + sides of these assignments, respectively. The values are strings that will + be written into the file verbatim. + + \nodefaultvalue +*/ diff --git a/share/qbs/modules/Exporter/pkgconfig/pkgconfig.qbs b/share/qbs/modules/Exporter/pkgconfig/pkgconfig.qbs index ebdee41f0..5fbda2bf4 100644 --- a/share/qbs/modules/Exporter/pkgconfig/pkgconfig.qbs +++ b/share/qbs/modules/Exporter/pkgconfig/pkgconfig.qbs @@ -21,6 +21,8 @@ Module { property stringList requiresPrivateEntry: [] property stringList conflictsEntry: [] + property var customVariables + property bool _usePrefix: autoDetect && qbs.installPrefix additionalProductTypes: ["Exporter.pkgconfig.pc"] @@ -53,6 +55,12 @@ Module { var f = new TextFile(output.filePath, TextFile.WriteOnly); if (product.Exporter.pkgconfig._usePrefix) f.writeLine("prefix=" + product.qbs.installPrefix + "\n"); + var customVariables = product.Exporter.pkgconfig.customVariables; + if (customVariables) { + for (var customVar in customVariables) + f.writeLine(customVar + "=" + customVariables[customVar]); + f.writeLine(""); + } var autoDetectedData = HelperFunctions.collectAutodetectedData(product); HelperFunctions.writeEntry(product, f, "Name", "nameEntry", true); HelperFunctions.writeEntry(product, f, "Description", "descriptionEntry", true); diff --git a/tests/auto/blackbox/testdata/exports-pkgconfig/TheSecondLib.pc b/tests/auto/blackbox/testdata/exports-pkgconfig/TheSecondLib.pc index baac6df44..6c54b451e 100644 --- a/tests/auto/blackbox/testdata/exports-pkgconfig/TheSecondLib.pc +++ b/tests/auto/blackbox/testdata/exports-pkgconfig/TheSecondLib.pc @@ -1,3 +1,6 @@ +config1=a b +config2=c + Name: TheSecondLib Description: The second lib Version: 2.0 diff --git a/tests/auto/blackbox/testdata/exports-pkgconfig/exports-pkgconfig.qbs b/tests/auto/blackbox/testdata/exports-pkgconfig/exports-pkgconfig.qbs index 1b1109ca7..7934dc3c9 100644 --- a/tests/auto/blackbox/testdata/exports-pkgconfig/exports-pkgconfig.qbs +++ b/tests/auto/blackbox/testdata/exports-pkgconfig/exports-pkgconfig.qbs @@ -80,6 +80,7 @@ Project { return value.filter(function(p) { return p !== product.sourceDirectory; }); return value; }) + Exporter.pkgconfig.customVariables: ({config1: "a b", config2: "c"}) Depends { name: "cpp" } cpp.defines: ["SECONDLIB"] |