Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. qmake function change global variable
Qt 6.12 LTS is out! See what's new in the release blog

qmake function change global variable

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
2 Posts 1 Posters 721 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • semlanikS Offline
    semlanikS Offline
    semlanik
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
    • semlanikS Offline
      semlanikS Offline
      semlanik
      wrote on last edited by semlanik
      #2

      Ok, solved.

      defineReplace(somefunc) {
          SOURCES += my_new_source.cpp
          export(SOURCES)
          return()
      }
      
      1 Reply Last reply
      1

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt
      • Unsolved