How to quell qmake's “WARNING: Failure to find:”?

喜欢而已 提交于 2019-12-05 07:21:34

How can I quell this warning

From my reading of the qmake code, it looks like you can:

  • either have qmake ignore any filenames that don't exist - in which case they won't get built by your later steps
  • or have it write these warnings

I don't think either of these would be satisfactory for you.


Here's my reasoning.... I had a hunt for the text Failure to find in a Qt distribution I had to hand: qt4.8.1.

It appeared 3 times in in qmake/generators/makefile.cpp. The two blocks of code look like this:

QStringList
MakefileGenerator::findFilesInVPATH(QStringList l, uchar flags, const QString &vpath_var)
{
....
                    debug_msg(1, "%s:%d Failure to find %s in vpath (%s)",
                              __FILE__, __LINE__,
                              val.toLatin1().constData(), vpath.join("::").toLatin1().constData());
                    if(flags & VPATH_RemoveMissingFiles)
                        remove_file = true;
                    else if(flags & VPATH_WarnMissingFiles)
                        warn_msg(WarnLogic, "Failure to find: %s", val.toLatin1().constData());
....
                else if(flags & VPATH_WarnMissingFiles)
                    warn_msg(WarnLogic, "Failure to find: %s", val.toLatin1().constData());

and this is called with:

        l = findFilesInVPATH(l, (comp.flags & Compiler::CompilerRemoveNoExist) ?
                             VPATH_RemoveMissingFiles : VPATH_WarnMissingFiles, "VPATH_" + comp.variable_in);

So the flags parameter passed in to the first block will be either RemoveMissingFiles or WarnMissingFiles, depending on comp.flags & Compiler::CompilerRemoveNoExist.


Or, is there a better way to generate intermediate files using qmake?

I'm not sure that it's better - i.e. it's certainly complex - but this is what is done where I work...

In the .pro file, a system call is done, that:

  1. generates the required files,
  2. and then writes out their names to stdout.

Here's an example from the .pro, to show how it would be called:

SOURCES    += $$system( python my_script_name.py )

You can of course pass arguments in to the python script, if you like

Things to note/limitations:

  • This means that the python script gets run whenever you run qmake, but not during individual make invocations
  • Each invocation of python really slows down our qmake steps - taking roughly twice as long as running qmake without launching python - but you could always use a different scripting language

This would fix your problem, in that by the time qmake processes the SOURCES value, the files have been created by the script.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!