<?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[Getting CMake&#x27;s FetchContent_Declare to pull from specific branch]]></title><description><![CDATA[<p dir="auto">Hello everyone, I don't know if here is the right place to ask, but I'm starting to work on my note editor again. Recently, MicroTeX has recieved updates, but they are not yet present on the master branch. I'm using it to render LaTeX fragments in QTextDocuments.</p>
<p dir="auto">my CMakeLists.txt contains these lines :</p>
<pre><code>FetchContent_Declare(MicroTeX
                     GIT_REPOSITORY https://github.com/NanoMichael/MicroTeX.git
                     GIT_TAG origin/master
)

FetchContent_MakeAvailable(MicroTeX)
</code></pre>
<p dir="auto">Since the most recent branch of MicroTeX is <em>openmath</em>, I've tried to change the GIT_TAG to <code>origin/openmath</code> or<br />
<code>"openmath"</code>. However, doing so blocks all builds, as CMake says it could not clone the repository. How Can I force CMake to use this branch ?</p>
<p dir="auto">Thanks for your answers.</p>
]]></description><link>https://forum.qt.io/topic/164936/getting-cmake-s-fetchcontent_declare-to-pull-from-specific-branch</link><generator>RSS for Node</generator><lastBuildDate>Wed, 30 Sep 2026 03:15:34 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/164936.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 26 Jul 2026 20:59:12 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Getting CMake&#x27;s FetchContent_Declare to pull from specific branch on Thu, 30 Jul 2026 17:16:06 GMT]]></title><description><![CDATA[<p dir="auto">The simplest: install the missing tinyxml2 dependency and stay with the master branch (instead of struggling with warnings-as-errors in the still unstable openmath branch), or alternatively disable "warnings as errors" specifically for the MicroTeX target if openmath is required.</p>
]]></description><link>https://forum.qt.io/post/839464</link><guid isPermaLink="true">https://forum.qt.io/post/839464</guid><dc:creator><![CDATA[Nils Sjoberg]]></dc:creator><pubDate>Thu, 30 Jul 2026 17:16:06 GMT</pubDate></item><item><title><![CDATA[Reply to Getting CMake&#x27;s FetchContent_Declare to pull from specific branch on Tue, 28 Jul 2026 18:50:33 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/paul-colby">@<bdi>Paul-Colby</bdi></a> Thanks for the clarification you made !</p>
<p dir="auto">I was way too terse with my answer.</p>
]]></description><link>https://forum.qt.io/post/839431</link><guid isPermaLink="true">https://forum.qt.io/post/839431</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Tue, 28 Jul 2026 18:50:33 GMT</pubDate></item><item><title><![CDATA[Reply to Getting CMake&#x27;s FetchContent_Declare to pull from specific branch on Tue, 28 Jul 2026 15:18:45 GMT]]></title><description><![CDATA[<p dir="auto">One thing I'd check first is whether the <code>openmath</code> branch actually exists on the remote and whether your local CMake cache is holding on to an older checkout.</p>
<p dir="auto">You could also try specifying the branch name directly:</p>
<pre><code class="language-cmake">FetchContent_Declare(
    MicroTeX
    GIT_REPOSITORY https://github.com/NanoMichael/MicroTeX.git
    GIT_TAG openmath
    GIT_SHALLOW FALSE
)
</code></pre>
<p dir="auto">If you've already configured the project once, delete the <code>_deps</code> directory (or at least the <code>microtex-src</code> folder) and rerun CMake so it performs a fresh clone. I've run into cases where <code>FetchContent</code> kept using the cached repository and ignored changes to <code>GIT_TAG</code>.</p>
<p dir="auto">If it still fails, does the error say it can't find the <code>openmath</code> ref, or is it failing during the clone itself? That detail would help narrow down whether it's a branch name issue or something else.</p>
]]></description><link>https://forum.qt.io/post/839428</link><guid isPermaLink="true">https://forum.qt.io/post/839428</guid><dc:creator><![CDATA[alexiaamber]]></dc:creator><pubDate>Tue, 28 Jul 2026 15:18:45 GMT</pubDate></item><item><title><![CDATA[Reply to Getting CMake&#x27;s FetchContent_Declare to pull from specific branch on Tue, 28 Jul 2026 10:04:25 GMT]]></title><description><![CDATA[<blockquote>
<p dir="auto">I've tried to change the <code>GIT_TAG</code> to <code>origin/openmath</code> or <code>"openmath"</code>. However, doing so blocks all builds, as CMake says it could not clone the repository.</p>
</blockquote>
<p dir="auto">Can you show us the error message?</p>
<p dir="auto">I used <code>GIT_TAG origin/openmath</code> and it fetched correctly, however broke the configure step because that branch's code is full of compiler warnings, treated as error.  (If I use <code>origin/master</code>, I get an unmet <code>tinyxml2</code> dependency instead, which I haven't bothered installing).</p>
<blockquote>
<p dir="auto">I think you should pass the commit hash matching that tag.</p>
</blockquote>
<p dir="auto">This is correct, you <em>should</em>, for security (not technical) reasons:</p>
<blockquote>
<p dir="auto">it is advisable to use a hash for <code>GIT_TAG</code> rather than a branch or tag name. A commit hash is more secure and helps to confirm that the downloaded contents are what you expected.<a href="https://cmake.org/cmake/help/latest/module/FetchContent.html#command:fetchcontent_declare" target="_blank" rel="noopener noreferrer nofollow ugc">^1</a></p>
</blockquote>
<p dir="auto">But branch and tag names work too.</p>
<p dir="auto">Since the <code>openmath</code> branch has not changed in 2 years, you could always try:</p>
<pre><code class="language-cmake">  GIT_TAG 086f4eb740270b28bd0c61a0a359aea9300d61ae # Current openmath HEAD.
</code></pre>
<p dir="auto">For which I get the same result as <code>GIT_TAG origin/openmath</code> - ie it fetches, just has compilation errors compiling the MicroTex  source.</p>
<p dir="auto">Cheers.</p>
]]></description><link>https://forum.qt.io/post/839426</link><guid isPermaLink="true">https://forum.qt.io/post/839426</guid><dc:creator><![CDATA[Paul Colby]]></dc:creator><pubDate>Tue, 28 Jul 2026 10:04:25 GMT</pubDate></item><item><title><![CDATA[Reply to Getting CMake&#x27;s FetchContent_Declare to pull from specific branch on Mon, 27 Jul 2026 18:28:50 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">From a quick look at the documentation of <a href="https://cmake.org/cmake/help/latest/module/FetchContent.html" target="_blank" rel="noopener noreferrer nofollow ugc">FetchContent_Declare</a>, I think you should pass the commit hash matching that tag.</p>
]]></description><link>https://forum.qt.io/post/839416</link><guid isPermaLink="true">https://forum.qt.io/post/839416</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Mon, 27 Jul 2026 18:28:50 GMT</pubDate></item></channel></rss>