int Option::init(int argc, char **argv) { Option::application_argv0 = 0; Option::cpp_moc_mod = ""; Option::h_moc_mod = "moc_"; Option::lex_mod = "_lex"; Option::yacc_mod = "_yacc"; Option::prl_ext = ".prl"; Option::libtool_ext = ".la"; Option::pkgcfg_ext = ".pc"; Option::prf_ext = ".prf"; Option::js_ext = ".js"; Option::ui_ext = ".ui"; Option::h_ext << ".h" << ".hpp" << ".hh" << ".hxx"; Option::c_ext << ".c"; #ifndef Q_OS_WIN Option::h_ext << ".H"; #endif Option::cpp_moc_ext = ".moc"; Option::h_moc_ext = ".cpp"; Option::cpp_ext << ".cpp" << ".cc" << ".cxx"; #ifndef Q_OS_WIN Option::cpp_ext << ".C"; #endif Option::lex_ext = ".l"; Option::yacc_ext = ".y"; Option::pro_ext = ".pro"; Option::mmp_ext = ".mmp"; #ifdef Q_OS_WIN Option::dirlist_sep = ";"; Option::shellPath = detectShellPath(); Option::res_ext = ".res"; #else Option::dirlist_sep = ":"; Option::shellPath = QStringList("sh"); #endif Option::sysenv_mod = "QMAKE_ENV_"; Option::field_sep = ' '; if(argc && argv) { Option::application_argv0 = argv[0]; QString argv0 = argv[0]; if(Option::qmake_mode == Option::QMAKE_GENERATE_NOTHING) Option::qmake_mode = default_mode(argv0); if(!argv0.isEmpty() && !QFileInfo(argv0).isRelative()) { Option::qmake_abslocation = argv0; } else if (argv0.contains(QLatin1Char('/')) #ifdef Q_OS_WIN || argv0.contains(QLatin1Char('\\')) #endif ) { //relative PWD Option::qmake_abslocation = QDir::current().absoluteFilePath(argv0); } else { //in the PATH QByteArray pEnv = qgetenv("PATH"); QDir currentDir = QDir::current(); #ifdef Q_OS_WIN QStringList paths = QString::fromLocal8Bit(pEnv).split(QLatin1String(";")); #else QStringList paths = QString::fromLocal8Bit(pEnv).split(QLatin1String(":")); #endif for (QStringList::const_iterator p = paths.constBegin(); p != paths.constEnd(); ++p) { if ((*p).isEmpty()) continue; QString candidate = currentDir.absoluteFilePath(*p + QLatin1Char('/') + argv0); #ifdef Q_OS_WIN candidate += ".exe"; #endif if (QFile::exists(candidate)) { Option::qmake_abslocation = candidate; break; } } } if(!Option::qmake_abslocation.isNull()) Option::qmake_abslocation = QDir::cleanPath(Option::qmake_abslocation); } else { Option::qmake_mode = Option::QMAKE_GENERATE_MAKEFILE; } const QByteArray envflags = qgetenv("QMAKEFLAGS"); if (!envflags.isNull()) { int env_argc = 0, env_size = 0, currlen=0; char quote = 0, **env_argv = NULL; for (int i = 0; i < envflags.size(); ++i) { if (!quote && (envflags.at(i) == '\'' || envflags.at(i) == '"')) { quote = envflags.at(i); } else if (envflags.at(i) == quote) { quote = 0; } else if (!quote && envflags.at(i) == ' ') { if (currlen && env_argv && env_argv[env_argc]) { env_argv[env_argc][currlen] = '\0'; currlen = 0; env_argc++; } } else { if(!env_argv || env_argc > env_size) { env_argv = (char **)realloc(env_argv, sizeof(char *)*(env_size+=10)); for(int i2 = env_argc; i2 < env_size; i2++) env_argv[i2] = NULL; } if(!env_argv[env_argc]) { currlen = 0; env_argv[env_argc] = (char*)malloc(255); } if(currlen < 255) env_argv[env_argc][currlen++] = envflags.at(i); } } if(env_argv) { if(env_argv[env_argc]) { env_argv[env_argc][currlen] = '\0'; currlen = 0; env_argc++; } parseCommandLine(env_argc, env_argv); for(int i2 = 0; i2 < env_size; i2++) { if(env_argv[i2]) free(env_argv[i2]); } free(env_argv); } } if(argc && argv) { int ret = parseCommandLine(argc, argv, 1); if(ret != Option::QMAKE_CMDLINE_SUCCESS) { if ((ret & Option::QMAKE_CMDLINE_SHOW_USAGE) != 0) usage(argv[0]); return ret; //return ret == QMAKE_CMDLINE_SHOW_USAGE ? usage(argv[0]) : false; } } //last chance for defaults if(Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE || Option::qmake_mode == Option::QMAKE_GENERATE_PRL) { if(Option::mkfile::qmakespec.isNull() || Option::mkfile::qmakespec.isEmpty()) Option::mkfile::qmakespec = QString::fromLocal8Bit(qgetenv("QMAKESPEC").constData()); //try REALLY hard to do it for them, lazy.. if(Option::mkfile::project_files.isEmpty()) { QString proj = detectProjectFile(qmake_getpwd()); if(!proj.isNull()) Option::mkfile::project_files.append(proj); #ifndef QT_BUILD_QMAKE_LIBRARY if(Option::mkfile::project_files.isEmpty()) { usage(argv[0]); return Option::QMAKE_CMDLINE_ERROR; } #endif } } else if (Option::qmake_mode == Option::QMAKE_GENERATE_PROJECT) { #if defined(Q_OS_MAC) Option::host_mode = Option::HOST_MACX_MODE; Option::target_mode = Option::TARG_MACX_MODE; #elif defined(Q_OS_UNIX) Option::host_mode = Option::HOST_UNIX_MODE; Option::target_mode = Option::TARG_UNIX_MODE; #else Option::host_mode = Option::HOST_WIN_MODE; Option::target_mode = Option::TARG_WIN_MODE; #endif } //defaults for globals if (Option::host_mode != Option::HOST_UNKNOWN_MODE) applyHostMode(); return QMAKE_CMDLINE_SUCCESS; }
int Option::parseCommandLine(int argc, char **argv, int skip) { bool before = true; for(int x = skip; x < argc; x++) { if(*argv[x] == '-' && strlen(argv[x]) > 1) { /* options */ QString opt = argv[x] + 1; //first param is a mode, or we default if(x == 1) { bool specified = true; if(opt == "project") { Option::recursive = Option::QMAKE_RECURSIVE_YES; Option::qmake_mode = Option::QMAKE_GENERATE_PROJECT; } else if(opt == "prl") { Option::mkfile::do_deps = false; Option::mkfile::do_mocs = false; Option::qmake_mode = Option::QMAKE_GENERATE_PRL; } else if(opt == "set") { Option::qmake_mode = Option::QMAKE_SET_PROPERTY; } else if(opt == "query") { Option::qmake_mode = Option::QMAKE_QUERY_PROPERTY; } else if(opt == "makefile") { Option::qmake_mode = Option::QMAKE_GENERATE_MAKEFILE; } else { specified = false; } if(specified) continue; } //all modes if(opt == "o" || opt == "output") { Option::output.setFileName(argv[++x]); } else if(opt == "after") { before = false; } else if(opt == "t" || opt == "template") { Option::user_template = argv[++x]; } else if(opt == "tp" || opt == "template_prefix") { Option::user_template_prefix = argv[++x]; } else if(opt == "macx") { fprintf(stderr, "-macx is deprecated.\n"); Option::host_mode = HOST_MACX_MODE; Option::target_mode = TARG_MACX_MODE; Option::target_mode_overridden = true; } else if(opt == "unix") { fprintf(stderr, "-unix is deprecated.\n"); Option::host_mode = HOST_UNIX_MODE; Option::target_mode = TARG_UNIX_MODE; Option::target_mode_overridden = true; } else if(opt == "win32") { fprintf(stderr, "-win32 is deprecated.\n"); Option::host_mode = HOST_WIN_MODE; Option::target_mode = TARG_WIN_MODE; Option::target_mode_overridden = true; } else if(opt == "d") { Option::debug_level++; } else if(opt == "version" || opt == "v" || opt == "-version") { fprintf(stdout, "QMake version %s\n" "Using Qt version %s in %s\n", qmake_version(), QT_VERSION_STR, QLibraryInfo::location(QLibraryInfo::LibrariesPath).toLatin1().constData()); #ifdef QMAKE_OPENSOURCE_VERSION fprintf(stdout, "QMake is Open Source software from Nokia Corporation and/or its subsidiary(-ies).\n"); #endif return Option::QMAKE_CMDLINE_BAIL; } else if(opt == "h" || opt == "help") { return Option::QMAKE_CMDLINE_SHOW_USAGE; } else if(opt == "Wall") { Option::warn_level |= WarnAll; } else if(opt == "Wparser") { Option::warn_level |= WarnParser; } else if(opt == "Wlogic") { Option::warn_level |= WarnLogic; } else if(opt == "Wnone") { Option::warn_level = WarnNone; } else if(opt == "r" || opt == "recursive") { Option::recursive = Option::QMAKE_RECURSIVE_YES; } else if(opt == "nr" || opt == "norecursive") { Option::recursive = Option::QMAKE_RECURSIVE_NO; } else if(opt == "config") { Option::user_configs += argv[++x]; } else { if(Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE || Option::qmake_mode == Option::QMAKE_GENERATE_PRL) { if(opt == "nodepend" || opt == "nodepends") { Option::mkfile::do_deps = false; } else if(opt == "nomoc") { Option::mkfile::do_mocs = false; } else if(opt == "nocache") { Option::mkfile::do_cache = false; } else if(opt == "createstub") { Option::mkfile::do_stub_makefile = true; } else if(opt == "nodependheuristics") { Option::mkfile::do_dep_heuristics = false; } else if(opt == "E") { Option::mkfile::do_preprocess = true; } else if(opt == "cache") { Option::mkfile::cachefile = argv[++x]; } else if(opt == "platform" || opt == "spec") { Option::mkfile::qmakespec = argv[++x]; Option::mkfile::qmakespec_commandline = argv[x]; } else { fprintf(stderr, "***Unknown option -%s\n", opt.toLatin1().constData()); return Option::QMAKE_CMDLINE_SHOW_USAGE | Option::QMAKE_CMDLINE_ERROR; } } else if(Option::qmake_mode == Option::QMAKE_GENERATE_PROJECT) { if(opt == "nopwd") { Option::projfile::do_pwd = false; } else { fprintf(stderr, "***Unknown option -%s\n", opt.toLatin1().constData()); return Option::QMAKE_CMDLINE_SHOW_USAGE | Option::QMAKE_CMDLINE_ERROR; } } } } else { QString arg = argv[x]; if(arg.indexOf('=') != -1) { if(before) Option::before_user_vars.append(arg); else Option::after_user_vars.append(arg); } else { bool handled = true; if(Option::qmake_mode == Option::QMAKE_QUERY_PROPERTY || Option::qmake_mode == Option::QMAKE_SET_PROPERTY) { Option::prop::properties.append(arg); } else { QFileInfo fi(arg); if(!fi.makeAbsolute()) //strange arg = fi.filePath(); if(Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE || 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) { Option::projfile::project_dirs.append(arg); } else { handled = false; } } if(!handled) { return Option::QMAKE_CMDLINE_SHOW_USAGE | Option::QMAKE_CMDLINE_ERROR; } } } } return Option::QMAKE_CMDLINE_SUCCESS; }
int Option::parseCommandLine(QStringList &args, QMakeCmdLineParserState &state) { enum { ArgNone, ArgOutput } argState = ArgNone; int x = 0; while (x < args.count()) { switch (argState) { case ArgOutput: Option::output.setFileName(args.at(x--)); args.erase(args.begin() + x, args.begin() + x + 2); argState = ArgNone; continue; default: QMakeGlobals::ArgumentReturn cmdRet = globals->addCommandLineArguments(state, args, &x); if (cmdRet == QMakeGlobals::ArgumentsOk) break; if (cmdRet == QMakeGlobals::ArgumentMalformed) { fprintf(stderr, "***Option %s requires a parameter\n", qPrintable(args.at(x - 1))); return Option::QMAKE_CMDLINE_SHOW_USAGE | Option::QMAKE_CMDLINE_ERROR; } Q_ASSERT(cmdRet == QMakeGlobals::ArgumentUnknown); QString arg = args.at(x); if (arg.startsWith(QLatin1Char('-'))) { if (arg == "-d") { Option::debug_level++; } else if (arg == "-v" || arg == "-version" || arg == "--version") { fprintf(stdout, "QMake version %s\n" "Using Qt version %s in %s\n", QMAKE_VERSION_STR, QT_VERSION_STR, QLibraryInfo::location(QLibraryInfo::LibrariesPath).toLatin1().constData()); #ifdef QMAKE_OPENSOURCE_VERSION fprintf(stdout, "QMake is Open Source software from Digia Plc and/or its subsidiary(-ies).\n"); #endif return Option::QMAKE_CMDLINE_BAIL; } else if (arg == "-h" || arg == "-help" || arg == "--help") { return Option::QMAKE_CMDLINE_SHOW_USAGE; } else if (arg == "-Wall") { Option::warn_level |= WarnAll; } else if (arg == "-Wparser") { Option::warn_level |= WarnParser; } else if (arg == "-Wlogic") { Option::warn_level |= WarnLogic; } else if (arg == "-Wdeprecated") { Option::warn_level |= WarnDeprecated; } else if (arg == "-Wnone") { Option::warn_level = WarnNone; } else if (arg == "-r" || arg == "-recursive") { Option::recursive = true; args.removeAt(x); continue; } else if (arg == "-nr" || arg == "-norecursive") { Option::recursive = false; args.removeAt(x); continue; } else if (arg == "-o" || arg == "-output") { argState = ArgOutput; } else { if (Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE || Option::qmake_mode == Option::QMAKE_GENERATE_PRL) { if (arg == "-nodepend" || arg == "-nodepends") { Option::mkfile::do_deps = false; } else if (arg == "-nomoc") { Option::mkfile::do_mocs = false; } else if (arg == "-createstub") { Option::mkfile::do_stub_makefile = true; } else if (arg == "-nodependheuristics") { Option::mkfile::do_dep_heuristics = false; } else if (arg == "-E") { Option::mkfile::do_preprocess = true; } else { fprintf(stderr, "***Unknown option %s\n", arg.toLatin1().constData()); return Option::QMAKE_CMDLINE_SHOW_USAGE | Option::QMAKE_CMDLINE_ERROR; } } else if (Option::qmake_mode == Option::QMAKE_GENERATE_PROJECT) { if (arg == "-nopwd") { Option::projfile::do_pwd = false; } else { fprintf(stderr, "***Unknown option %s\n", arg.toLatin1().constData()); return Option::QMAKE_CMDLINE_SHOW_USAGE | Option::QMAKE_CMDLINE_ERROR; } } } } else { bool handled = true; if(Option::qmake_mode == Option::QMAKE_QUERY_PROPERTY || Option::qmake_mode == Option::QMAKE_SET_PROPERTY || Option::qmake_mode == Option::QMAKE_UNSET_PROPERTY) { Option::prop::properties.append(arg); } else { QFileInfo fi(arg); if(!fi.makeAbsolute()) //strange arg = fi.filePath(); if(Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE || 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) { Option::projfile::project_dirs.append(arg); } else { handled = false; } } if(!handled) { return Option::QMAKE_CMDLINE_SHOW_USAGE | Option::QMAKE_CMDLINE_ERROR; } args.removeAt(x); continue; } } x++; } if (argState != ArgNone) { fprintf(stderr, "***Option %s requires a parameter\n", qPrintable(args.at(x - 1))); return Option::QMAKE_CMDLINE_SHOW_USAGE | Option::QMAKE_CMDLINE_ERROR; } return Option::QMAKE_CMDLINE_SUCCESS; }
int Option::init(int argc, char **argv) { Option::prf_ext = ".prf"; Option::pro_ext = ".pro"; Option::field_sep = ' '; if(argc && argv) { QString argv0 = argv[0]; if(Option::qmake_mode == Option::QMAKE_GENERATE_NOTHING) Option::qmake_mode = default_mode(argv0); if(!argv0.isEmpty() && !QFileInfo(argv0).isRelative()) { globals->qmake_abslocation = argv0; } else if (argv0.contains(QLatin1Char('/')) #ifdef Q_OS_WIN || argv0.contains(QLatin1Char('\\')) #endif ) { //relative PWD globals->qmake_abslocation = QDir::current().absoluteFilePath(argv0); } else { //in the PATH QByteArray pEnv = qgetenv("PATH"); QDir currentDir = QDir::current(); #ifdef Q_OS_WIN QStringList paths = QString::fromLocal8Bit(pEnv).split(QLatin1String(";")); paths.prepend(QLatin1String(".")); #else QStringList paths = QString::fromLocal8Bit(pEnv).split(QLatin1String(":")); #endif for (QStringList::const_iterator p = paths.constBegin(); p != paths.constEnd(); ++p) { if ((*p).isEmpty()) continue; QString candidate = currentDir.absoluteFilePath(*p + QLatin1Char('/') + argv0); #ifdef Q_OS_WIN if (!candidate.endsWith(QLatin1String(".exe"))) candidate += QLatin1String(".exe"); #endif if (QFile::exists(candidate)) { globals->qmake_abslocation = candidate; break; } } } if (!globals->qmake_abslocation.isNull()) globals->qmake_abslocation = QDir::cleanPath(globals->qmake_abslocation); else // This is rather unlikely to ever happen on a modern system ... globals->qmake_abslocation = QLibraryInfo::rawLocation(QLibraryInfo::HostBinariesPath, QLibraryInfo::EffectivePaths) + #ifdef Q_OS_WIN "/qmake.exe"; #else "/qmake"; #endif } else { Option::qmake_mode = Option::QMAKE_GENERATE_MAKEFILE; } QMakeCmdLineParserState cmdstate(QDir::currentPath()); const QByteArray envflags = qgetenv("QMAKEFLAGS"); if (!envflags.isNull()) { QStringList args; QByteArray buf = ""; char quote = 0; bool hasWord = false; for (int i = 0; i < envflags.size(); ++i) { char c = envflags.at(i); if (!quote && (c == '\'' || c == '"')) { quote = c; } else if (c == quote) { quote = 0; } else if (!quote && c == ' ') { if (hasWord) { args << QString::fromLocal8Bit(buf); hasWord = false; buf = ""; } } else { buf += c; hasWord = true; } } if (hasWord) args << QString::fromLocal8Bit(buf); parseCommandLine(args, cmdstate); cmdstate.flush(); } if(argc && argv) { QStringList args; for (int i = 1; i < argc; i++) args << QString::fromLocal8Bit(argv[i]); while (!args.isEmpty()) { QString opt = args.at(0); if (opt == "-project") { Option::recursive = true; Option::qmake_mode = Option::QMAKE_GENERATE_PROJECT; } else if (opt == "-prl") { Option::mkfile::do_deps = false; Option::mkfile::do_mocs = false; 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") { Option::qmake_mode = Option::QMAKE_GENERATE_MAKEFILE; } else { break; } args.takeFirst(); break; } int ret = parseCommandLine(args, cmdstate); if(ret != Option::QMAKE_CMDLINE_SUCCESS) { if ((ret & Option::QMAKE_CMDLINE_SHOW_USAGE) != 0) usage(argv[0]); return ret; //return ret == QMAKE_CMDLINE_SHOW_USAGE ? usage(argv[0]) : false; } globals->qmake_args = args; } globals->commitCommandLineArguments(cmdstate); globals->debugLevel = Option::debug_level; //last chance for defaults if(Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE || Option::qmake_mode == Option::QMAKE_GENERATE_PRL) { globals->useEnvironment(); //try REALLY hard to do it for them, lazy.. if(Option::mkfile::project_files.isEmpty()) { QString proj = detectProjectFile(qmake_getpwd()); if(!proj.isNull()) Option::mkfile::project_files.append(proj); #ifndef QT_BUILD_QMAKE_LIBRARY if(Option::mkfile::project_files.isEmpty()) { usage(argv[0]); return Option::QMAKE_CMDLINE_ERROR; } #endif } } return QMAKE_CMDLINE_SUCCESS; }
int Option::parseCommandLine(QStringList &args) { QStringList user_configs; bool before = true; args << QString(); // Avoid bounds checking for options which take an argument for (int x = 0; x < args.size() - 1; ) { QString arg = args.at(x); if (arg.size() > 1 && arg.startsWith('-')) { /* options */ QString opt = arg.mid(1); if(opt == "o" || opt == "output") { Option::output.setFileName(args.at(x + 1)); args.erase(args.begin() + x, args.begin() + x + 2); continue; } else if(opt == "after") { before = false; } else if(opt == "t" || opt == "template") { Option::user_template = args.at(++x); } else if(opt == "tp" || opt == "template_prefix") { Option::user_template_prefix = args.at(++x); } else if(opt == "unix") { Option::dir_sep = "/"; } else if(opt == "win32") { Option::dir_sep = "\\"; } else if(opt == "d") { Option::debug_level++; } else if(opt == "version" || opt == "v" || opt == "-version") { fprintf(stdout, "QMake version %s\n" "Using Qt version %s in %s\n", qmake_version(), QT_VERSION_STR, QLibraryInfo::location(QLibraryInfo::LibrariesPath).toLatin1().constData()); #ifdef QMAKE_OPENSOURCE_VERSION fprintf(stdout, "QMake is Open Source software from Nokia Corporation and/or its subsidiary(-ies).\n"); #endif return Option::QMAKE_CMDLINE_BAIL; } else if(opt == "h" || opt == "help") { return Option::QMAKE_CMDLINE_SHOW_USAGE; } else if(opt == "Wall") { Option::warn_level |= WarnAll; } else if(opt == "Wparser") { Option::warn_level |= WarnParser; } else if(opt == "Wlogic") { Option::warn_level |= WarnLogic; } else if(opt == "Wdeprecated") { Option::warn_level |= WarnDeprecated; } else if(opt == "Wnone") { Option::warn_level = WarnNone; } else if(opt == "r" || opt == "recursive") { Option::recursive = true; args.removeAt(x); continue; } else if(opt == "nr" || opt == "norecursive") { Option::recursive = false; args.removeAt(x); continue; } else if(opt == "config") { user_configs += args.at(++x); } else { if(Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE || Option::qmake_mode == Option::QMAKE_GENERATE_PRL) { if(opt == "nodepend" || opt == "nodepends") { Option::mkfile::do_deps = false; } else if(opt == "nomoc") { Option::mkfile::do_mocs = false; } else if(opt == "nocache") { Option::mkfile::do_cache = false; } else if(opt == "createstub") { Option::mkfile::do_stub_makefile = true; } else if(opt == "nodependheuristics") { Option::mkfile::do_dep_heuristics = false; } else if(opt == "E") { Option::mkfile::do_preprocess = true; } else if(opt == "cache") { Option::mkfile::cachefile = args.at(++x); } else if(opt == "platform" || opt == "spec") { Option::mkfile::qmakespec = args[x] = cleanSpec(args.at(++x)); } else if (opt == "xplatform" || opt == "xspec") { Option::mkfile::xqmakespec = args[x] = cleanSpec(args.at(x)); } else { fprintf(stderr, "***Unknown option -%s\n", opt.toLatin1().constData()); return Option::QMAKE_CMDLINE_SHOW_USAGE | Option::QMAKE_CMDLINE_ERROR; } } else if(Option::qmake_mode == Option::QMAKE_GENERATE_PROJECT) { if(opt == "nopwd") { Option::projfile::do_pwd = false; } else { fprintf(stderr, "***Unknown option -%s\n", opt.toLatin1().constData()); return Option::QMAKE_CMDLINE_SHOW_USAGE | Option::QMAKE_CMDLINE_ERROR; } } } } else { if(arg.indexOf('=') != -1) { if(before) Option::before_user_vars.append(arg); else Option::after_user_vars.append(arg); } else { bool handled = true; if(Option::qmake_mode == Option::QMAKE_QUERY_PROPERTY || Option::qmake_mode == Option::QMAKE_SET_PROPERTY || Option::qmake_mode == Option::QMAKE_UNSET_PROPERTY) { Option::prop::properties.append(arg); } else { QFileInfo fi(arg); if(!fi.makeAbsolute()) //strange arg = fi.filePath(); if(Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE || 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) { Option::projfile::project_dirs.append(arg); } else { handled = false; } } if(!handled) { return Option::QMAKE_CMDLINE_SHOW_USAGE | Option::QMAKE_CMDLINE_ERROR; } args.removeAt(x); continue; } } x++; } if (!user_configs.isEmpty()) Option::before_user_vars += "CONFIG += " + user_configs.join(" "); if (Option::mkfile::xqmakespec.isEmpty()) Option::mkfile::xqmakespec = Option::mkfile::qmakespec; args.takeLast(); return Option::QMAKE_CMDLINE_SUCCESS; }