Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Run script only in Release mode



  • Hi,

    I have Qt Creator run a script every time I do a build (for versioning). I'd like that script to only run for release builds. Is there a way I can do that?

    I currently have:

    versionTarget.target = src/include/version.h
    versionTarget.depends = FORCE
    versionTarget.commands = cd ..; pwd ; echo update version ... ; ./rev.sh ; touch src/include/version.h
    PRE_TARGETDEPS += src/include/version.h
    QMAKE_EXTRA_TARGETS += versionTarget
    

    in my .pro file.

    Thanks,
    Gerald


  • Moderators

    hey, @GeraldBrandt

    this should work

    CONFIG(release, debug|release){
    versionTarget.target = src/include/version.h
    versionTarget.depends = FORCE
    versionTarget.commands = cd ..; pwd ; echo update version ... ; ./rev.sh ; touch src/include/version.h
    PRE_TARGETDEPS += src/include/version.h
    QMAKE_EXTRA_TARGETS += versionTarget
    }
    


  • @J-Hilk Thanks for the quick response, I'll try it! While I'm on the topic, how about running the script in Release mode and under Linux only?

    Is there a document I'm missing that covers this?

    Gerald


  • Moderators

    @GeraldBrandt
    take a look at the documentation section scopes and conditions

    I believe for Linux the identifier is unix


Log in to reply