Important: Please read the Qt Code of Conduct -

How do I generate different Makefile versions for a project for different compile options other than debug/release... user define options

  • I currently use hand crafted makefiles and I want to convert to using qmake.
    I have a master make file at the root of my source tree. When I make at this level, it drills down through the source tree issuing gmake commands for sub projects and passing certain options to the make files for the sub projects. The complication in converting to qmake arises in that I don't know how to handle this particular situation which is, that some projects want other projects built differently, that other projects would want that same project built. For example...

    Project A depends on Project B built with options X, Y, Z


    Project C depends on Project B built with only option Y.

    I know i need a .pro file for each project, but I am not sure how to use qmake to generate the appropriate Makefile for project B in each case.

    If I could pass user define arguments to qmake with the pro filename I guess I could handle it that way, but how can I pass variables in to my .pro file to determine the Makefile generated...

    Any suggestions?


  • Just create 2 .pro files (you can put options that are shared in a .pri file and use include()) and adjust $$DESTDIR and all directories that will contain intermediate files that are different between the two versions:

Log in to reply