Qt Commercial Support Weekly #5: qmake and Giving Mac Some Love
As I have mentioned before in previous support weeklies, qmake is a powerful and useful tool. It is also one close to my heart as I have worked a lot on it in the past including the XCode 4 support that was done recently.
What came up recently in support is someone who wanted to provide a way to ensure that something was always recompiled when an application was built. To do this manually you would need to do:
But, this is always prone to errors as you may forget to do the touch and also this case may be a rather simplified version of what you want to do with each build. Luckily, what you can do is utilize the QMAKE_EXTRA_TARGETS directive and the PRE_TARGETDEPS variable inside your pro file to set something up.
QMAKE_EXTRA_TARGETS is useful for adding extra targets to your Makefiles so you can have something that builds a different part or does some other commands, but for this case we will just have a command that touches the main.cpp for us. So the following can be done to do this:
updatemain.commands = touch main.cpp
QMAKE_EXTRA_TARGETS += updatemain
The commands part can contain whatever you want to do inside the target, then we just add the extra target to the list of QMAKE_EXTRA_TARGETS. All that is left for us to do now is to ensure this is done before the target is built and thus ensure it gets recompiled. To do this we add the extra target to the PRE_TARGETDEPS variable like:
PRE_TARGETDEPS += updatemain
After rerunning qmake it will invoke the updatemain.commands for us each time we make.
In other areas this week, we managed to fix a couple of Mac specific issues, one involving clicking on submenu entries in a menu in the menubar. What would happen is that this would act as if an action had been invoked instead of doing nothing. The other issue was with palette changes being lost when the application had been deactivated and then reactivated. Both of these fixes are available via the support team, so just contact us via the Qt Commercial customer portal if you want any of these fixes.
Finally, if you happen to be in San Francisco for Qt Developer Days (Nov 29 - Dec 1) then please stop by the support desk and say hello! I personally won't be there, but there are four eager support engineers waiting to help you with any questions you may have.
Subscribe to our newsletter
Try Qt 5.12 LTS Now!
Download the latest release here: www.qt.io/download.
Qt 5.12 was developed with a strong focus on quality and is a long-term-supported (LTS) release that will be supported for 3 years.
Check out all our open positions here and follow us on Instagram to see what it's like to be #QtPeople.
Näytä tämä julkaisu Instagramissa.
Want to build something for tomorrow, join #QtPeople today! We have loads of cool jobs you don’t want to miss! http://qt.io/careers #builtwithQt #software #developers #coding #framework #tool #tooling #C++ #QML #engineers #sales #tech #technology #UI #UX #CX #Qt #Qtdev #global #openpositions #careers #job
Henkilön Qt (@theqtcompany) jakama julkaisu