Qmake (.pro) syntax question



  • hi

    I'm looking for the option to build static library (Win32/64).
    current piece of PRO:
    TARGET = MyProject
    TEMPLATE = lib
    CONFIG += staticlib
    however the output is dll anyway.
    how can I fix this?


  • Moderators

    Hi,

    First, you must build Qt 5 itself as a static library. When you configure Qt, add the "-static" flag.



  • I'm using qt creator for pure win32 app, without qt.
    so I don't see any qt references in my pro file and don't see where dll is specified


  • Moderators

    Ah, I see. I don't know the answer then, sorry.



  • Try removing all qt related stuff with these:
    @CONFIG -= app_bundle
    CONFIG -= qt@
    However, by using the lib template and staticlib config it should get it done correctly. At least, it does for me. You may also want to try with CONFIG -= shared so to remove any option for building a shared library.



  • I've removed generated Makefile, Makefile.Debug, Makefile.Release manually
    and rebuilt project and now it works correctly.

    Looks oddly for me - why "Clean" functionality doesn't do the same ? and I have to perform the cleaning manually ...



  • Sometimes it might be useful to manually run qmake (from the menubar: Build > Run qmake).
    Some changes in your .pro file might be overseen by qmake 8especially if they're made externally from Qt Creator), so the makefiles are not updated correctly. The clean step does not remove makefiles since it's qmake that handles them, so you may experience these little problems.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.