Important: Please read the Qt Code of Conduct -

[Solved] How to append version to target [Win XP - Qt5.0.2]

  • Hello !

    I'm trying to append the version number of my app, in the target filename. I tried "this": but it's not showing.

    Here is an extract:

    @VER_MAJ = 0
    VER_MIN = 2
    VER_BLD = $$cat(BUILD, lines)

    TARGET = PMF-Desktop
    TEMPLATE = app@

    The thing is: When I message, the version is ok, but the filename is still "PMF_Desktop.exe". I tried to append it to the "TARGET" variable, or put it in "TARGET_x.y.z =" which BTW I don't understand (messaging it shows empty line). When I append it to "TARGET", it's OK but QtCreator can't start my app (shows something like: permission denied or file doesn't exist).

    Any idea of how to do it (maybe the way changed with Qt5) and how to use "TARGET_x.y.z" ?
    Thank you.

  • Moderators

    i'm not sure if it works but try using MODULE_VERSION instead of VERSION.
    p.s. dont forget to rerun qmake ;)

  • [quote author="raven-worx" date="1371555920"]try using MODULE_VERSION instead of VERSION.[/quote]
    Where did you get that variable ?
    It's not even in the "variable reference": :p

    I've just tried it, nothing changed. Thank you anyway.

  • Moderators

    [quote author="Max13" date="1371560274"]
    Where did you get that variable ?
    It's not even in the "variable reference": :p[/quote]
    from the Qt sources.

    But you could do this?
    TARGET = PMF-Desktop$${VER_MAJ}
    or do you want the full version in the target name?

  • @TARGET = PMF-Desktop_$${VERSION}@
    Actually, this is working, but I have a "$$system()" above which get the build number from a file and increment it.

    I don't know why, but when I message() in the .pro file, it's shown 3 times (which created the bug above, about permissions), so the variable is incremented 3 times (I have a subdir project) and the generated file isn't the same as the one QtCreator wants to start.
    ANyway, it's not the same issue, so I can consider this one done =P

Log in to reply