Explanation of QMAKE_CFLAGS_RELEASE and QMAKE_LFLAGS_RELEASE in mkspecs/qmake.conf

  • I want to compile Qt 5.0.2 statically with MSVC2010 and I tried to google how to do that.

    I've read that I should modify QMAKE_CFLAGS_RELEASE to '-Ol -Og -GL -MD' in the qmake.conf. The original flags are '-O2 -MD'

    Somewhere else I read that I have to modify QMAKE_LFLAGS_RELEASE.

    So I asked myself what do this flags mean? I wasn't able to find documentation of this macros/flags.

    Can someone explain me what this flags mean?

  • Lifetime Qt Champion


    CFLAGS are used at compilation time (by the compiler)
    LFLAGS at linking time (by the linker)

    The flags themselves are platform dependent

    The O flag is for optimization (speed/size etc...)
    MD to link against multi-threaded DLL runtime
    MT to link multi-threaded static runtime

    Hope it helps

  • Thank you for your reply. That makes things a little bit clearer...

    If the O flag means optimization, what does the number or the second letter stands for? Ol, O2, Og?

    And what means the GL flag?

    What do I have to edit if I want a static build?

    Is there a general description of the flags?

    Edit: I think I found it "here":http://msdn.microsoft.com/en-us/library/fwkeyyhe.aspx

    Many questions :-)

  • Lifetime Qt Champion

    Depends on what you mean by static build:

    Qt static against dynamic runtime ? (Recommended)
    Simply run configure with -static.

    If you want Qt static against static runtime you'll have to edit the makespec and change MD to MT (there might be other modifications to do but I don't know them from the top of my head)

    IIRC there is something about that in the documentation.

Log in to reply

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