summaryrefslogtreecommitdiffstats
path: root/qmake
diff options
context:
space:
mode:
authorDarryl L. Miles <darryl.miles@darrylmiles.org>2011-04-08 10:10:42 (GMT)
committerOswald Buddenhagen <oswald.buddenhagen@nokia.com>2011-04-08 10:14:10 (GMT)
commit0dc9c8eb8535b1a678360e4d3183f0b1b5e79db3 (patch)
treec749783132beb283f27ec2211a912d8c9c5b67de /qmake
parent8031eada2f81963865390b4d899631b09d4ca6f3 (diff)
downloadQt-0dc9c8eb8535b1a678360e4d3183f0b1b5e79db3.zip
Qt-0dc9c8eb8535b1a678360e4d3183f0b1b5e79db3.tar.gz
Qt-0dc9c8eb8535b1a678360e4d3183f0b1b5e79db3.tar.bz2
Add support for -unset <prop> option to qmake.
Merge-request: 1175 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
Diffstat (limited to 'qmake')
-rw-r--r--qmake/main.cpp4
-rw-r--r--qmake/option.cpp6
-rw-r--r--qmake/option.h5
-rw-r--r--qmake/property.cpp14
-rw-r--r--qmake/property.h1
5 files changed, 26 insertions, 4 deletions
diff --git a/qmake/main.cpp b/qmake/main.cpp
index 7dab23d..7d4d458 100644
--- a/qmake/main.cpp
+++ b/qmake/main.cpp
@@ -126,7 +126,9 @@ int runQMake(int argc, char **argv)
}
QMakeProperty prop;
- if(Option::qmake_mode == Option::QMAKE_QUERY_PROPERTY || Option::qmake_mode == Option::QMAKE_SET_PROPERTY)
+ if(Option::qmake_mode == Option::QMAKE_QUERY_PROPERTY ||
+ Option::qmake_mode == Option::QMAKE_SET_PROPERTY ||
+ Option::qmake_mode == Option::QMAKE_UNSET_PROPERTY)
return prop.exec() ? 0 : 101;
QMakeProject project(&prop);
diff --git a/qmake/option.cpp b/qmake/option.cpp
index 1354281..c1b43e8 100644
--- a/qmake/option.cpp
+++ b/qmake/option.cpp
@@ -192,6 +192,7 @@ bool usage(const char *a0)
" -norecursive Don't do a recursive search\n"
" -recursive Do a recursive search\n"
" -set <prop> <value> Set persistent property\n"
+ " -unset <prop> Unset persistent property\n"
" -query <prop> Query persistent property. Show all if <prop> is empty.\n"
" -cache file Use file as cache [makefile mode only]\n"
" -spec spec Use spec as QMAKESPEC [makefile mode only]\n"
@@ -226,6 +227,8 @@ Option::parseCommandLine(int argc, char **argv, int skip)
Option::qmake_mode = Option::QMAKE_GENERATE_PRL;
} else if(opt == "set") {
Option::qmake_mode = Option::QMAKE_SET_PROPERTY;
+ } else if(opt == "unset") {
+ Option::qmake_mode = Option::QMAKE_UNSET_PROPERTY;
} else if(opt == "query") {
Option::qmake_mode = Option::QMAKE_QUERY_PROPERTY;
} else if(opt == "makefile") {
@@ -336,7 +339,8 @@ Option::parseCommandLine(int argc, char **argv, int skip)
} else {
bool handled = true;
if(Option::qmake_mode == Option::QMAKE_QUERY_PROPERTY ||
- Option::qmake_mode == Option::QMAKE_SET_PROPERTY) {
+ Option::qmake_mode == Option::QMAKE_SET_PROPERTY ||
+ Option::qmake_mode == Option::QMAKE_UNSET_PROPERTY) {
Option::prop::properties.append(arg);
} else {
QFileInfo fi(arg);
diff --git a/qmake/option.h b/qmake/option.h
index bc87343..e17ce5a 100644
--- a/qmake/option.h
+++ b/qmake/option.h
@@ -148,8 +148,9 @@ struct Option
}
//global qmake mode, can only be in one mode per invocation!
- enum QMAKE_MODE { QMAKE_GENERATE_NOTHING, QMAKE_GENERATE_PROJECT, QMAKE_GENERATE_MAKEFILE,
- QMAKE_GENERATE_PRL, QMAKE_SET_PROPERTY, QMAKE_QUERY_PROPERTY };
+ enum QMAKE_MODE { QMAKE_GENERATE_NOTHING,
+ QMAKE_GENERATE_PROJECT, QMAKE_GENERATE_MAKEFILE, QMAKE_GENERATE_PRL,
+ QMAKE_SET_PROPERTY, QMAKE_UNSET_PROPERTY, QMAKE_QUERY_PROPERTY };
static QMAKE_MODE qmake_mode;
//all modes
diff --git a/qmake/property.cpp b/qmake/property.cpp
index d84f8e1..0c36c1c 100644
--- a/qmake/property.cpp
+++ b/qmake/property.cpp
@@ -160,6 +160,13 @@ QMakeProperty::setValue(QString var, const QString &val)
settings->setValue(keyBase() + var, val);
}
+void
+QMakeProperty::remove(const QString &var)
+{
+ initSettings();
+ settings->remove(keyBase() + var);
+}
+
bool
QMakeProperty::exec()
{
@@ -230,6 +237,13 @@ QMakeProperty::exec()
if(!var.startsWith("."))
setValue(var, (*it));
}
+ } else if(Option::qmake_mode == Option::QMAKE_UNSET_PROPERTY) {
+ for(QStringList::ConstIterator it = Option::prop::properties.begin();
+ it != Option::prop::properties.end(); it++) {
+ QString var = (*it);
+ if(!var.startsWith("."))
+ remove(var);
+ }
}
return ret;
}
diff --git a/qmake/property.h b/qmake/property.h
index 43b7529..5e8379e 100644
--- a/qmake/property.h
+++ b/qmake/property.h
@@ -62,6 +62,7 @@ public:
bool hasValue(QString);
QString value(QString v) { return value(v, false); }
void setValue(QString, const QString &);
+ void remove(const QString &);
bool exec();
};