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

[cmake] excessive compilation of Import.cpp files for static plugins

    XMLWordPrintable

Details

    Description

      with 5.14 statically linked plugins pull in Import.cpp files into every downstream target. these downstream targets can be static intermediate libraries or final targets (executables or loadable modules)

      in my use case i'm having dozens of intermediate targets, each will compile their own copy of the Import.cpp files, which slows down the build process quite a bit.

      one could avoid excessive compilation by using object libraries in a pattern like this:

      add_library(FooPluginImporter OBJECT FooPlugin_Import.cpp)
      add_library(FooPlugin [...])
      target_sources(FooPlugin INTERFACE $<TARGET_OBJECTS:FooPluginImporter>)

      this will cause the Import.cpp file to be compiled only once, but the object file will be linked into every target downstream of FooPlugin

      Attachments

        Issue Links

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

          Activity

            People

              alexandru.croitor Alexandru Croitor
              timblechmann tim blechmann
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: