Added addToOtherLinkerFlags and removeFromOtherLinkerFlags to pbxProject
diff --git a/lib/pbxProject.js b/lib/pbxProject.js
index 3628401..fc92af9 100644
--- a/lib/pbxProject.js
+++ b/lib/pbxProject.js
@@ -850,6 +850,52 @@
}
}
}
+
+pbxProject.prototype.addToOtherLinkerFlags = function (flag) {
+ var configurations = nonComments(this.pbxXCBuildConfigurationSection()),
+ INHERITED = '"$(inherited)"',
+ OTHER_LDFLAGS = 'OTHER_LDFLAGS',
+ config, buildSettings;
+
+ for (config in configurations) {
+ buildSettings = configurations[config].buildSettings;
+
+ if (unquote(buildSettings['PRODUCT_NAME']) != this.productName)
+ continue;
+
+ if (!buildSettings[OTHER_LDFLAGS]
+ || buildSettings[OTHER_LDFLAGS] === INHERITED) {
+ buildSettings[OTHER_LDFLAGS] = [INHERITED];
+ }
+
+ buildSettings[OTHER_LDFLAGS].push(flag);
+ }
+}
+
+pbxProject.prototype.removeFromOtherLinkerFlags = function (flag) {
+ var configurations = nonComments(this.pbxXCBuildConfigurationSection()),
+ OTHER_LDFLAGS = 'OTHER_LDFLAGS',
+ config, buildSettings;
+
+ for (config in configurations) {
+ buildSettings = configurations[config].buildSettings;
+
+ if (unquote(buildSettings['PRODUCT_NAME']) != this.productName) {
+ continue;
+ }
+
+ if (buildSettings[OTHER_LDFLAGS]) {
+ var matches = buildSettings[OTHER_LDFLAGS].filter(function (p) {
+ return p.indexOf(flag) > -1;
+ });
+ matches.forEach(function (m) {
+ var idx = buildSettings[OTHER_LDFLAGS].indexOf(m);
+ buildSettings[OTHER_LDFLAGS].splice(idx, 1);
+ });
+ }
+ }
+}
+
// a JS getter. hmmm
pbxProject.prototype.__defineGetter__("productName", function () {
var configurations = nonComments(this.pbxXCBuildConfigurationSection()),