Search code examples
c++qtcompilationqmakeqwt

Include another project's qmake file in my qmake's project


I'm tired of having to compile Qwt (or any other Qt project for that matter) separately every time when something changes, such as the version of Qt or the architecture. So:

I would like to add the make file of Qwt to my project, such that the files of Qwt, that get compiled, go into my shadow build folder, where I can link with them easily without having to modify my qmake pro file.

How can I do that?

Apparently including the qmake file with include(../Qwt/qwt.pro) in my project doesn't do it. Doing this will make Qt search for Qwt files in the project's qmake file's directory.

There's not much documentation provided about that. All I could find is one page which talks very briefly about it.

Thank you for any efforts.


Solution

  • I think all you need is subdirs project template.

    Example: In my repo I have 3 projects in 3 different folders. Folders struct:

    MyProject\
        MyProject.pro
        Project_1\
            Project_1.pro
        Project_2\
            Project_2.pro
        Peoject_3\
            Project_3.pro
    

    In root directory I have project with template subdirs (MyProject.pro):

    TEMPLATE = subdirs
    
    SUBDIRS = \
        Project_1 \
        Project_2 \
        Project_3 
    
    Project_3.depends = Project_1 Project_2 
    

    Then I build MyProject.pro, it compiles all projects to shadow build directory. Then I rebuild only projects that I change. When I need rebuild all projects, I buld MyProject.pro. No need to modify any .pro files.