<?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[Setting up a SUBDIRS project correctly]]></title><description><![CDATA[<p dir="auto">Using qmake in Qt Creator 18.0.2, I'm investigating the different possibilities of setting up the global "Default Build Directory" in Qt Creator settings (in "Preferences/Build &amp; Run") to facilitate doing out-of-source builds. I see many wildcards I can use, such as <code>"%{BuildConfig:Name}"</code> and <code>"%{Project:Name}"</code>, but I can't find anything that would allow inserting the contents of the qmake <code>TEMPLATE</code>.</p>
<p dir="auto">The project consists of one main SUBDIRS project file, calling this "<a href="http://MyApp.pro" target="_blank" rel="noopener noreferrer nofollow ugc">MyApp.pro</a>", an "<a href="http://App.pro" target="_blank" rel="noopener noreferrer nofollow ugc">App.pro</a>" with TEMPLATE=app and two subprojects, each of which have TEMPLATE=lib. These "lib" subprojects are responsible for generating one static library each. The source code is organized like this -- the folders marked with "SCM" are under source code management, and any build folders or binary files, should be placed outside of these:</p>
<pre><code>  MyApp
  ├── 3rd_party  &lt;== SCM 'REPO_THIRD'
  │   ├── lib_1
  │   │   └── src
  │   └── lib_2
  │       └── src
  └── App  &lt;== SCM 'REPO_APP'
      ├── include
      ├── qrc
      ├── src
      ├── translations
      └── ui
      App.pro
      MyApp.pro 
      Lib_1.pro
      Lib_2.pro
</code></pre>
<p dir="auto">I know that it is unusual to have all of the .pro files in the same folder as the main project, but this works out well. I can get <code>MyApp.pro</code> to build the application correctly with this as my default build in "Preferences":</p>
<pre><code>../build/%{Project:Name}/%{Qt:Version}/%{BuildConfig:Name}
</code></pre>
<p dir="auto">This results in the following shadowed build folder after opening the main "MyApp" project file in Qt Creator when I click on "Projects" in the task bar:</p>
<pre><code>MyApp/build/MyApp/6.10.2/Debug
</code></pre>
<p dir="auto">using a kit for Qt 6.10.2, for example, building in Debug mode. I create a "lib" folder parallel to the "build" folder in the library projects by setting DESTDIR and TARGET appropriately.</p>
<p dir="auto">Since I would eventually like to migrate the qmake build to CMake (or at least offer a CMake build as an alternative to the qmake build), the folder structure should end up looking something like this:</p>
<pre><code>  MyApp
  ├── build
  │   ├── appbuild 
  │   │   ├── Debug
  │   │   └── Release
  │   └── libbuild
  │       ├── Debug
  │       └── Release
  ├── 3rd_party  &lt;== SCM 'REPO_THIRD'
  │   ├── Lib_1
  │   │   └── src
  │   └── Lib_2
  │       └── src
  └── App  &lt;== SCM 'REPO_APP'
(etc.)
</code></pre>
<p dir="auto">That way, the "build" subfolder can be created in the traditional (?) CMake fashion either in Creator or by doing <code>cmake -B build</code> from the project directory.</p>
<p dir="auto">But what is the trick for getting the strings "appbuild" and "libbuild" into the "Default Build Directory" setting? I don't want to have to manually edit the shadow build directory for each configuration. Ideally, one should be able to write <code>%{Project:Template}</code> to achieve this, but i couldn't find anything.</p>
]]></description><link>https://forum.qt.io/topic/164285/setting-up-a-subdirs-project-correctly</link><generator>RSS for Node</generator><lastBuildDate>Tue, 04 Aug 2026 15:28:12 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/164285.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 18 Feb 2026 15:01:15 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Setting up a SUBDIRS project correctly on Thu, 19 Feb 2026 13:04:42 GMT]]></title><description><![CDATA[<p dir="auto">I have solved this by defining everything under the "build" folder in the different *.pro files. It seems that if a subproject is configured individually, i.e. outside of the SUBDIRS project, whatever configuration is overridden by the SUBDIRS main project configuration.</p>
<p dir="auto">I put the "TEMPLATE=lib" subproject files into the "3rd_party" folder. The only drawback is then that the different <code>Makefiles.*</code> and <code>.qmake.stash</code> files used in building the libraries are also generated in that folder which is under source code management. However, these can be ignored by the SCM by applying the corresponding settings necessary for ignoring certain files.</p>
]]></description><link>https://forum.qt.io/post/836417</link><guid isPermaLink="true">https://forum.qt.io/post/836417</guid><dc:creator><![CDATA[Robert Hairgrove]]></dc:creator><pubDate>Thu, 19 Feb 2026 13:04:42 GMT</pubDate></item></channel></rss>