Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-20785

Option to add an extra #include to MOC generated files.

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Done
    • Not Evaluated
    • 5.0.0
    • 4.7.3
    • Build tools: moc
    • None
    • Windows / MSVC. Possibly useful for others.

    Description

      For large projects it would be really useful to have the option to force the moc to add a specific #include before the automatic one, primarily to support the use of precompiled headers (like stdafx.h) with MSVC. This can greatly improve compile times.

      Something like the option "-b<file>" which adds "#include <file>" before the regular include would be most useful. I've seen patches for moc on the web which almost do this, but it would be better if it was supported in the core version.

      I first raised this in the Qt Dev net forum : http://developer.qt.nokia.com/forums/viewthread/8506/ . Here loladiro notes that the "-f<file>" option already exists, but this replaces the automatic #include, rather than adding one.

      The PRECOMPILED_HEADER in qmake may be an option, but actually I'm using cmake to generate the moc commands [I can easily force an extra option to be passed to the moc this way].
      Thanks.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            hhartz Henrik Hartz (closed Nokia identity) (Inactive)
            jds21 John Stark
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes