summaryrefslogtreecommitdiffstats
path: root/qmake/project.cpp
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>2012-05-09 15:29:25 +0200
committerOswald Buddenhagen <oswald.buddenhagen@nokia.com>2012-06-19 16:39:56 +0200
commitbf984d5f24741a52a70024f3f43432307281f0ae (patch)
tree6197ea782c8dce78fcdd260d34e4ed07b175aa12 /qmake/project.cpp
parent6a66fef520d0fb2b8d507c3e91e03338fc39a57e (diff)
add $$shadowed() function
return the build directory corresponding to a given source directory. this is the identity function if not shadow-building. if input lies outside the source directory, return empty value. Change-Id: I2d2a6b1112bd19989fe29cfe19a12d39a0d208c1 Reviewed-by: Marius Storm-Olsen <marius.storm-olsen@nokia.com>
Diffstat (limited to 'qmake/project.cpp')
-rw-r--r--qmake/project.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/qmake/project.cpp b/qmake/project.cpp
index 1df4bf0200..de010faeb8 100644
--- a/qmake/project.cpp
+++ b/qmake/project.cpp
@@ -81,7 +81,8 @@ enum ExpandFunc { E_MEMBER=1, E_FIRST, E_LAST, E_CAT, E_FROMFILE, E_EVAL, E_LIST
E_SPRINTF, E_JOIN, E_SPLIT, E_BASENAME, E_DIRNAME, E_SECTION,
E_FIND, E_SYSTEM, E_UNIQUE, E_QUOTE, E_ESCAPE_EXPAND,
E_UPPER, E_LOWER, E_FILES, E_PROMPT, E_RE_ESCAPE, E_VAL_ESCAPE, E_REPLACE,
- E_SIZE, E_SORT_DEPENDS, E_RESOLVE_DEPENDS, E_ENUMERATE_VARS };
+ E_SIZE, E_SORT_DEPENDS, E_RESOLVE_DEPENDS, E_ENUMERATE_VARS,
+ E_SHADOWED };
QHash<QString, ExpandFunc> qmake_expandFunctions()
{
static QHash<QString, ExpandFunc> *qmake_expand_functions = 0;
@@ -117,6 +118,7 @@ QHash<QString, ExpandFunc> qmake_expandFunctions()
qmake_expand_functions->insert("sort_depends", E_SORT_DEPENDS);
qmake_expand_functions->insert("resolve_depends", E_RESOLVE_DEPENDS);
qmake_expand_functions->insert("enumerate_vars", E_ENUMERATE_VARS);
+ qmake_expand_functions->insert("shadowed", E_SHADOWED);
}
return *qmake_expand_functions;
}
@@ -2493,6 +2495,13 @@ QMakeProject::doProjectExpand(QString func, QList<QStringList> args_list,
case E_ENUMERATE_VARS:
ret += place.keys();
break;
+ case E_SHADOWED: {
+ QString val = QDir::cleanPath(QFileInfo(args.at(0)).absoluteFilePath());
+ if (Option::mkfile::source_root.isEmpty())
+ ret += val;
+ else if (val.startsWith(Option::mkfile::source_root))
+ ret += Option::mkfile::build_root + val.mid(Option::mkfile::source_root.length());
+ break; }
default: {
fprintf(stderr, "%s:%d: Unknown replace function: %s\n",
parser.file.toLatin1().constData(), parser.line_no,