From 14bbab09c158e3eb54169b42c4a303d396a32f0e Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 31 Jan 2012 18:36:18 +0100 Subject: introduce ability to build projects for the host system when qmake runs into the new option(host_build) command, it will restart the project evaluation with a host spec. the new default host spec is called default-host (gasp!). it is overridden with the pre-exising -spec / -platform option, while the new -xspec / -xplatform option overrides the pre-existing default spec. specifying -spec but not -xspec will set the xspec, too, so the behavior is backwards-compatible. same for the XQMAKESPEC override read from .qmake.cache and the environment variable. the cleaner solution would be adding -hostspec, to be symmetrical with the override semantics, but that would deviate from configure in turn. Change-Id: I4297c873780af16ab7928421b434ce0f1d3820da Reviewed-by: Joerg Bornemann --- qmake/option.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'qmake/option.cpp') diff --git a/qmake/option.cpp b/qmake/option.cpp index de907f0528..836cc3f492 100644 --- a/qmake/option.cpp +++ b/qmake/option.cpp @@ -107,6 +107,7 @@ QStringList Option::projfile::project_dirs; //QMAKE_GENERATE_MAKEFILE stuff QString Option::mkfile::qmakespec; +QString Option::mkfile::xqmakespec; int Option::mkfile::cachefile_depth = -1; bool Option::mkfile::do_deps = true; bool Option::mkfile::do_mocs = true; @@ -117,6 +118,7 @@ bool Option::mkfile::do_cache = true; QString Option::mkfile::cachefile; QStringList Option::mkfile::project_files; QString Option::mkfile::qmakespec_commandline; +QString Option::mkfile::xqmakespec_commandline; static Option::QMAKE_MODE default_mode(QString progname) { @@ -327,6 +329,9 @@ Option::parseCommandLine(int argc, char **argv, int skip) } else if(opt == "platform" || opt == "spec") { Option::mkfile::qmakespec = cleanSpec(argv[++x]); Option::mkfile::qmakespec_commandline = argv[x]; + } else if (opt == "xplatform" || opt == "xspec") { + Option::mkfile::xqmakespec = cleanSpec(argv[++x]); + Option::mkfile::xqmakespec_commandline = argv[x]; } else { fprintf(stderr, "***Unknown option -%s\n", opt.toLatin1().constData()); return Option::QMAKE_CMDLINE_SHOW_USAGE | Option::QMAKE_CMDLINE_ERROR; @@ -381,6 +386,9 @@ Option::parseCommandLine(int argc, char **argv, int skip) if (!user_configs.isEmpty()) Option::before_user_vars += "CONFIG += " + user_configs.join(" "); + if (Option::mkfile::xqmakespec.isEmpty()) + Option::mkfile::xqmakespec = Option::mkfile::qmakespec; + return Option::QMAKE_CMDLINE_SUCCESS; } @@ -536,8 +544,13 @@ Option::init(int argc, char **argv) //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()) + if (Option::mkfile::xqmakespec.isEmpty()) + Option::mkfile::xqmakespec = QString::fromLocal8Bit(qgetenv("XQMAKESPEC").constData()); + if (Option::mkfile::qmakespec.isEmpty()) { Option::mkfile::qmakespec = QString::fromLocal8Bit(qgetenv("QMAKESPEC").constData()); + if (Option::mkfile::xqmakespec.isEmpty()) + Option::mkfile::xqmakespec = Option::mkfile::qmakespec; + } //try REALLY hard to do it for them, lazy.. if(Option::mkfile::project_files.isEmpty()) { -- cgit v1.2.3