Important: Please read the Qt Code of Conduct -

Source files compiled multiple times with Qt Test

  • Hello !

    I noticed that when I use Qt test in my project, so when I have the main project, containing the app project and the test project, the source files used in both are built twice (even if they are located at the same place on the disk).

        |----- App/
                 |----- foo.cpp
        |----- Tests/
                 |----- project/app/foo.cpp

    Here foo.cpp is built twice.
    Is the only solution to use a third DLL project building only once these common files or is there an option to share object files between project ?

    Thanks for your help !

  • Lifetime Qt Champion

    Since the source file can be compiled with different compiler options I don't see a chance other than creating a shared lib - qmake simply can't know if the generated object file is compiled with the same options (at least not that easy that it's worth the trouble).

  • Oh yes, it's logic. Thanks !!!

Log in to reply