QMake: Add option to set qt.conf file.

Change-Id: Ie5db11892ccf2d357773a4db6a0464bf27be9a26
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
This commit is contained in:
David Schulz 2015-07-13 11:21:22 +02:00
parent 2f83e38bfc
commit dbf1c2eb9f
5 changed files with 15 additions and 2 deletions

View File

@ -67,7 +67,9 @@ defineTest(qtCompileTest) {
mkpath($$test_out_dir)|error("Aborting.") mkpath($$test_out_dir)|error("Aborting.")
qtRunLoggedCommand("$$test_cmd_base $$system_quote($$system_path($$QMAKE_QMAKE)) -spec $$QMAKESPEC $$qmake_configs $$shell_quote($$test_dir)") { !isEmpty (QMAKE_QTCONF): qtconfarg = -qtconf $$QMAKE_QTCONF
qtRunLoggedCommand("$$test_cmd_base $$system_quote($$system_path($$QMAKE_QMAKE)) $$qtconfarg -spec $$QMAKESPEC $$qmake_configs $$shell_quote($$test_dir)") {
qtRunLoggedCommand("$$test_cmd_base $$QMAKE_MAKE") { qtRunLoggedCommand("$$test_cmd_base $$QMAKE_MAKE") {
log("yes$$escape_expand(\\n)") log("yes$$escape_expand(\\n)")
msg = "test $$1 succeeded" msg = "test $$1 succeeded"

View File

@ -992,6 +992,8 @@ void QMakeEvaluator::loadDefaults()
vars[ProKey("QMAKE_QMAKE")] << ProString(m_option->qmake_abslocation); vars[ProKey("QMAKE_QMAKE")] << ProString(m_option->qmake_abslocation);
if (!m_option->qmake_args.isEmpty()) if (!m_option->qmake_args.isEmpty())
vars[ProKey("QMAKE_ARGS")] = ProStringList(m_option->qmake_args); vars[ProKey("QMAKE_ARGS")] = ProStringList(m_option->qmake_args);
if (!m_option->qtconf.isEmpty())
vars[ProKey("QMAKE_QTCONF")] = ProString(m_option->qtconf);
vars[ProKey("QMAKE_HOST.cpu_count")] = ProString(QString::number(idealThreadCount())); vars[ProKey("QMAKE_HOST.cpu_count")] = ProString(QString::number(idealThreadCount()));
#if defined(Q_OS_WIN32) #if defined(Q_OS_WIN32)
vars[ProKey("QMAKE_HOST.os")] << ProString("Windows"); vars[ProKey("QMAKE_HOST.os")] << ProString("Windows");

View File

@ -128,7 +128,7 @@ QString QMakeGlobals::cleanSpec(QMakeCmdLineParserState &state, const QString &s
QMakeGlobals::ArgumentReturn QMakeGlobals::addCommandLineArguments( QMakeGlobals::ArgumentReturn QMakeGlobals::addCommandLineArguments(
QMakeCmdLineParserState &state, QStringList &args, int *pos) QMakeCmdLineParserState &state, QStringList &args, int *pos)
{ {
enum { ArgNone, ArgConfig, ArgSpec, ArgXSpec, ArgTmpl, ArgTmplPfx, ArgCache } argState = ArgNone; enum { ArgNone, ArgConfig, ArgSpec, ArgXSpec, ArgTmpl, ArgTmplPfx, ArgCache, ArgQtConf } argState = ArgNone;
for (; *pos < args.count(); (*pos)++) { for (; *pos < args.count(); (*pos)++) {
QString arg = args.at(*pos); QString arg = args.at(*pos);
switch (argState) { switch (argState) {
@ -153,6 +153,9 @@ QMakeGlobals::ArgumentReturn QMakeGlobals::addCommandLineArguments(
case ArgCache: case ArgCache:
cachefile = args[*pos] = QDir::cleanPath(QDir(state.pwd).absoluteFilePath(arg)); cachefile = args[*pos] = QDir::cleanPath(QDir(state.pwd).absoluteFilePath(arg));
break; break;
case ArgQtConf:
qtconf = args[*pos] = QDir::cleanPath(QDir(state.pwd).absoluteFilePath(arg));
break;
default: default:
if (arg.startsWith(QLatin1Char('-'))) { if (arg.startsWith(QLatin1Char('-'))) {
if (arg == QLatin1String("-after")) if (arg == QLatin1String("-after"))
@ -163,6 +166,8 @@ QMakeGlobals::ArgumentReturn QMakeGlobals::addCommandLineArguments(
do_cache = false; do_cache = false;
else if (arg == QLatin1String("-cache")) else if (arg == QLatin1String("-cache"))
argState = ArgCache; argState = ArgCache;
else if (arg == QLatin1String("-qtconf"))
argState = ArgQtConf;
else if (arg == QLatin1String("-platform") || arg == QLatin1String("-spec")) else if (arg == QLatin1String("-platform") || arg == QLatin1String("-spec"))
argState = ArgSpec; argState = ArgSpec;
else if (arg == QLatin1String("-xplatform") || arg == QLatin1String("-xspec")) else if (arg == QLatin1String("-xplatform") || arg == QLatin1String("-xspec"))

View File

@ -112,6 +112,7 @@ public:
QString qmake_abslocation; QString qmake_abslocation;
QStringList qmake_args; QStringList qmake_args;
QString qtconf;
QString qmakespec, xqmakespec; QString qmakespec, xqmakespec;
QString user_template, user_template_prefix; QString user_template, user_template_prefix;
QString precmds, postcmds; QString precmds, postcmds;

View File

@ -172,6 +172,7 @@ bool usage(const char *a0)
" -set <prop> <value> Set persistent property\n" " -set <prop> <value> Set persistent property\n"
" -unset <prop> Unset persistent property\n" " -unset <prop> Unset persistent property\n"
" -query <prop> Query persistent property. Show all if <prop> is empty.\n" " -query <prop> Query persistent property. Show all if <prop> is empty.\n"
" -qtconf file Use file instead of looking for qt.conf\n"
" -cache file Use file as cache [makefile mode only]\n" " -cache file Use file as cache [makefile mode only]\n"
" -spec spec Use spec as QMAKESPEC [makefile mode only]\n" " -spec spec Use spec as QMAKESPEC [makefile mode only]\n"
" -nocache Don't use a cache file [makefile mode only]\n" " -nocache Don't use a cache file [makefile mode only]\n"
@ -642,6 +643,8 @@ qmakeAddCacheClear(qmakeCacheClearFunc func, void **data)
QString qmake_libraryInfoFile() QString qmake_libraryInfoFile()
{ {
if (!Option::globals->qtconf.isEmpty())
return Option::globals->qtconf;
if (!Option::globals->qmake_abslocation.isEmpty()) if (!Option::globals->qmake_abslocation.isEmpty())
return QDir(QFileInfo(Option::globals->qmake_abslocation).absolutePath()).filePath("qt.conf"); return QDir(QFileInfo(Option::globals->qmake_abslocation).absolutePath()).filePath("qt.conf");
return QString(); return QString();