[Scons-users] Qt tools can't find generated headers using VariantDir

Dirk Bächle tshortik at gmx.de
Sat Feb 23 05:59:37 EST 2013


Hi Kyle,

On 23.02.2013 00:04, Strand, Kyle J wrote:

> This is actually kind of a repeat of a question I've asked before on

> the mailing list, but it appears that the Qt4 and Qt5 tools don't

> properly handle using VariantDir with the duplicate set to false.

> Included in the Qt4 tool's test directory is a simple setup that uses

> VariantDir. If you change the VariantDir() call to have duplicate=0,

> the build fails with the error "Cannot open include file:

> 'ui_anUiFile.h': No such file or directory". I assume this is because

> when duplicate is set to false, SCons attempts to adjust pathnames

> according to whether they are targets or source files, and the paths

> to header files generated by the Qt tool are somehow improperly

> handled. The workaround I've found is to explicitly make the build

> directory an include path for files in the source directory, but this

> doesn't seem like it should be necessary. Is there a more appropriate

> way to make this work? Is this a bug in the Qt tools?

>


I don't think it's a bug. It's just what happens when you spread your
build over two directories, without adjusting the search path for
includes accordingly. ;)
Based on your "duplicate=0", SCons doesn't create a copy of MyForm.h/cpp
in the build dir as was done before.
So, when the compiler looks for "ui_anUiFile.h" in the current folder
(which is "." for MyForm.*), it can't be found.


> For reference, here's the complete SConstruct file from the Qt4 tool's

> test directory, with the appropriate modification to make it fail:

>

> import qtenv

>

> qtEnv = qtenv.createQtEnvironment()

> qtEnv.EnableQt4Modules(['QtCore','QtGui'])

>

> qtEnv.VariantDir('bld', '.',duplicate=0)

> qtEnv.Uic4('bld/anUiFile.ui')

> qtEnv.Program('bld/test_realqt', ['bld/mocFromCpp.cpp',

> 'bld/mocFromH.cpp',

> 'bld/MyForm.cpp',

> 'bld/main.cpp'])

>

> Note that it still fails if you use the Qt5 tool instead.

>


Please add a

qtEnv.Append(CPPPATH=['bld'])

, it makes the build pass on my side.

Best regards,

Dirk

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://four.pairlist.net/pipermail/scons-users/attachments/20130223/304b7ebc/attachment.html>


More information about the Scons-users mailing list