qmake math operation (increment)



  • Hello,

    I am trying to to add build increment mechanism within .pro file.

    To do so I have created a file named "version" with this content "1.1.15" (MAJOR_VERSION.MINOR_VERSION.BUILD_NUMBER)

    Please find here my .pro content

    MY_VERSION = "$$cat(version)"
    
    VERSIONS = $$split(MY_VERSION, ".")
    
    VERSION_MAJ = $$member(VERSIONS, 0)
    VERSION_MIN = $$member(VERSIONS, 1)
    VERSION_BUILD = $$member(VERSIONS, 2)
    
    # VERSION_BUILD++ ??? HOW TO ???
    
    VERSIONS = $$VERSION_MAJ $$VERSION_MIN $$VERSION_BUILD
    MY_VERSION = $$join(VERSIONS, ".")
    
    write_file(version, MY_VERSION)
    

    Could someone help me on this ?



  • @tarekb could be a possible solution

    win32 {
        VERSION_BUILD = $$system("set /a $$VERSION_BUILD + 1")
    } else:unix {
        VERSION_BUILD = $$system("echo $(($$VERSION_BUILD + 1))")
    }
    

Log in to reply
 

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