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

qmake function change global variable



  • Hi,

    I would like to change global-scope variable in my qmake function like

    defineReplace(somefunc) {
        SOURCES += my_new_source.cpp
        return()
    }
    
    SOURCES += main.cpp
    
    ret = $$somefunc() #At this point I expect that SOURCES == main.cpp my_new_source.cpp, but it's not
    

    Any idea how to solve this?



  • Ok, solved.

    defineReplace(somefunc) {
        SOURCES += my_new_source.cpp
        export(SOURCES)
        return()
    }
    

Log in to reply