<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Is there a way to tell QMake to run a script after the build has finished?]]></title><description><![CDATA[<p dir="auto">Hello,</p>
<p dir="auto">I want to run a deployment script after the build has finished, if the build was set to the RELEASE setting.<br />
Is it possible to somehow tell QMake to run a script after it's done building?</p>
]]></description><link>https://forum.qt.io/topic/136917/is-there-a-way-to-tell-qmake-to-run-a-script-after-the-build-has-finished</link><generator>RSS for Node</generator><lastBuildDate>Mon, 08 Jun 2026 14:04:48 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/136917.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 01 Jun 2022 06:13:52 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Is there a way to tell QMake to run a script after the build has finished? on Mon, 06 Jun 2022 04:53:04 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/joecfd">@<bdi>JoeCFD</bdi></a><br />
From what I understand, QMAKE_POST_LINK will run a script after linking. but not after building. (IE, before the .exe file is generated).</p>
<p dir="auto">The other solution there involves making an extra build target with a dummy <code>cpp</code> file like so:</p>
<pre><code>TEMPLATE = lib
SOURCES = placeholder.cpp # &lt;== dummy cpp
CONFIG += no_link staticlib
batch_runner.target   = placeholder.cpp
batch_runner.commands = my_batch_file.bat # &lt;== script to be run
QMAKE_EXTRA_TARGETS   = batch_runner
</code></pre>
<p dir="auto">Is this the optimal solution?</p>
]]></description><link>https://forum.qt.io/post/716576</link><guid isPermaLink="true">https://forum.qt.io/post/716576</guid><dc:creator><![CDATA[Curtwagner1984]]></dc:creator><pubDate>Mon, 06 Jun 2022 04:53:04 GMT</pubDate></item><item><title><![CDATA[Reply to Is there a way to tell QMake to run a script after the build has finished? on Wed, 01 Jun 2022 14:00:43 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/curtwagner1984">@<bdi>Curtwagner1984</bdi></a> <a href="https://stackoverflow.com/questions/3612283/running-a-program-script-from-qmake" target="_blank" rel="noopener noreferrer nofollow ugc">https://stackoverflow.com/questions/3612283/running-a-program-script-from-qmake</a></p>
]]></description><link>https://forum.qt.io/post/716136</link><guid isPermaLink="true">https://forum.qt.io/post/716136</guid><dc:creator><![CDATA[JoeCFD]]></dc:creator><pubDate>Wed, 01 Jun 2022 14:00:43 GMT</pubDate></item><item><title><![CDATA[Reply to Is there a way to tell QMake to run a script after the build has finished? on Wed, 01 Jun 2022 14:00:19 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/joecfd">@<bdi>JoeCFD</bdi></a><br />
Maybe it's the same in QMake, the link <a class="plugin-mentions-user plugin-mentions-a" href="/user/vronin">@<bdi>VRonin</bdi></a>  posted also has to do with adding a build target. Sadly I don't get exactly how to use it.</p>
]]></description><link>https://forum.qt.io/post/716135</link><guid isPermaLink="true">https://forum.qt.io/post/716135</guid><dc:creator><![CDATA[Curtwagner1984]]></dc:creator><pubDate>Wed, 01 Jun 2022 14:00:19 GMT</pubDate></item><item><title><![CDATA[Reply to Is there a way to tell QMake to run a script after the build has finished? on Wed, 01 Jun 2022 13:58:51 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/curtwagner1984">@<bdi>Curtwagner1984</bdi></a> Sorry that is for cmake.</p>
]]></description><link>https://forum.qt.io/post/716134</link><guid isPermaLink="true">https://forum.qt.io/post/716134</guid><dc:creator><![CDATA[JoeCFD]]></dc:creator><pubDate>Wed, 01 Jun 2022 13:58:51 GMT</pubDate></item><item><title><![CDATA[Reply to Is there a way to tell QMake to run a script after the build has finished? on Wed, 01 Jun 2022 13:55:15 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/joecfd">@<bdi>JoeCFD</bdi></a></p>
<p dir="auto">Thank you for the link. I still fail to understand what I have to do.</p>
<pre><code>add_custom_command(
        OUTPUT
            ${CMAKE_CURRENT_BINARY_DIR}/__header.h
            ${CMAKE_CURRENT_BINARY_DIR}/header.h
        DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/OriginalHeader.h
        COMMAND python ${py_cmd}
)
</code></pre>
<p dir="auto">As far as I understand, the relevant command here is <code> COMMAND python ${py_cmd}</code> and what tells it to run is the custom target? Also, I'm using QMake, is it the same?</p>
]]></description><link>https://forum.qt.io/post/716132</link><guid isPermaLink="true">https://forum.qt.io/post/716132</guid><dc:creator><![CDATA[Curtwagner1984]]></dc:creator><pubDate>Wed, 01 Jun 2022 13:55:15 GMT</pubDate></item><item><title><![CDATA[Reply to Is there a way to tell QMake to run a script after the build has finished? on Wed, 01 Jun 2022 13:47:18 GMT]]></title><description><![CDATA[<p dir="auto"><a href="https://stackoverflow.com/questions/49053544/how-do-i-run-a-python-script-every-time-in-a-cmake-build" target="_blank" rel="noopener noreferrer nofollow ugc">https://stackoverflow.com/questions/49053544/how-do-i-run-a-python-script-every-time-in-a-cmake-build</a></p>
]]></description><link>https://forum.qt.io/post/716129</link><guid isPermaLink="true">https://forum.qt.io/post/716129</guid><dc:creator><![CDATA[JoeCFD]]></dc:creator><pubDate>Wed, 01 Jun 2022 13:47:18 GMT</pubDate></item><item><title><![CDATA[Reply to Is there a way to tell QMake to run a script after the build has finished? on Wed, 01 Jun 2022 12:25:22 GMT]]></title><description><![CDATA[<p dir="auto">Could you please elaborate? I don't quite understand what I should do.</p>
<p dir="auto">Let's say I have a python script called <code>myscript.py</code> in the <code>$PWD</code> of the project. What do I need to do to run it after the build is finished?</p>
<p dir="auto">I want to do something like</p>
<pre><code>ONCE_BUILDING_FINISHED_RUN_COMMAND ( $$system(python "$${PWD}/myscript.py" SOME_ARG)
</code></pre>
<p dir="auto">I admit that I don't quite understand how to do that from the link you provided.</p>
]]></description><link>https://forum.qt.io/post/716110</link><guid isPermaLink="true">https://forum.qt.io/post/716110</guid><dc:creator><![CDATA[Curtwagner1984]]></dc:creator><pubDate>Wed, 01 Jun 2022 12:25:22 GMT</pubDate></item><item><title><![CDATA[Reply to Is there a way to tell QMake to run a script after the build has finished? on Wed, 01 Jun 2022 08:56:43 GMT]]></title><description><![CDATA[<p dir="auto"><a href="https://doc.qt.io/qt-5/qmake-advanced-usage.html#adding-custom-targets" target="_blank" rel="noopener noreferrer nofollow ugc">https://doc.qt.io/qt-5/qmake-advanced-usage.html#adding-custom-targets</a></p>
]]></description><link>https://forum.qt.io/post/716096</link><guid isPermaLink="true">https://forum.qt.io/post/716096</guid><dc:creator><![CDATA[VRonin]]></dc:creator><pubDate>Wed, 01 Jun 2022 08:56:43 GMT</pubDate></item></channel></rss>