summaryrefslogtreecommitdiffstats
path: root/qmake
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@gmail.com>2009-10-05 16:25:21 (GMT)
committerOswald Buddenhagen <oswald.buddenhagen@nokia.com>2009-10-06 09:24:25 (GMT)
commit97dbf38496b36ba283f9d21d5ab1e806590e00e9 (patch)
tree8aa276ad6daf891e7e216d6323f9019f71c53b20 /qmake
parentf86eddcd9c92f40e5ea35016ced1bc30ef34f8a2 (diff)
downloadQt-97dbf38496b36ba283f9d21d5ab1e806590e00e9.zip
Qt-97dbf38496b36ba283f9d21d5ab1e806590e00e9.tar.gz
Qt-97dbf38496b36ba283f9d21d5ab1e806590e00e9.tar.bz2
Patched qmake to try to resolve a directory argument in makefile mode.
Merge-request: 1674 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
Diffstat (limited to 'qmake')
-rw-r--r--qmake/option.cpp36
1 files changed, 25 insertions, 11 deletions
diff --git a/qmake/option.cpp b/qmake/option.cpp
index c503b08..e851e79 100644
--- a/qmake/option.cpp
+++ b/qmake/option.cpp
@@ -136,6 +136,20 @@ static Option::QMAKE_MODE default_mode(QString progname)
return Option::QMAKE_GENERATE_MAKEFILE;
}
+static QString detectProjectFile(const QString &path)
+{
+ QString ret;
+ QDir dir(path);
+ if(dir.exists(dir.dirName() + Option::pro_ext)) {
+ ret = dir.filePath(dir.dirName()) + Option::pro_ext;
+ } else { //last try..
+ QStringList profiles = dir.entryList(QStringList("*" + Option::pro_ext));
+ if(profiles.count() == 1)
+ ret = dir.filePath(profiles.at(0));
+ }
+ return ret;
+}
+
QString project_builtin_regx();
bool usage(const char *a0)
{
@@ -322,12 +336,18 @@ Option::parseCommandLine(int argc, char **argv, int skip)
if(!fi.makeAbsolute()) //strange
arg = fi.filePath();
if(Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE ||
- Option::qmake_mode == Option::QMAKE_GENERATE_PRL)
+ Option::qmake_mode == Option::QMAKE_GENERATE_PRL) {
+ if(fi.isDir()) {
+ QString proj = detectProjectFile(arg);
+ if (!proj.isNull())
+ arg = proj;
+ }
Option::mkfile::project_files.append(arg);
- else if(Option::qmake_mode == Option::QMAKE_GENERATE_PROJECT)
+ } else if(Option::qmake_mode == Option::QMAKE_GENERATE_PROJECT) {
Option::projfile::project_dirs.append(arg);
- else
+ } else {
handled = false;
+ }
}
if(!handled) {
return Option::QMAKE_CMDLINE_SHOW_USAGE | Option::QMAKE_CMDLINE_ERROR;
@@ -494,15 +514,9 @@ Option::init(int argc, char **argv)
//try REALLY hard to do it for them, lazy..
if(Option::mkfile::project_files.isEmpty()) {
- QString pwd = qmake_getpwd(),
- proj = pwd + "/" + pwd.right(pwd.length() - (pwd.lastIndexOf('/') + 1)) + Option::pro_ext;
- if(QFile::exists(proj)) {
+ QString proj = detectProjectFile(qmake_getpwd());
+ if(!proj.isNull())
Option::mkfile::project_files.append(proj);
- } else { //last try..
- QStringList profiles = QDir(pwd).entryList(QStringList("*" + Option::pro_ext));
- if(profiles.count() == 1)
- Option::mkfile::project_files.append(pwd + "/" + profiles[0]);
- }
#ifndef QT_BUILD_QMAKE_LIBRARY
if(Option::mkfile::project_files.isEmpty()) {
usage(argv[0]);