<?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[Qt 6 and CMake platform dependent code not working. Why?]]></title><description><![CDATA[<p dir="auto">Hello!</p>
<p dir="auto">Does anyone know about Qt 6 platform dependant code and how it need to be done now? Got strange problem with Qt 6 and CMake when trying to implement different pice of code for each of platform:</p>
<pre><code>#if defined(Q_OS_MAC)
	pHandler = qobject_cast&lt;AStoreKitNativeHandlerInterface*&gt;(
		new AStoreKitIOSNativeHandler(this)
	);
#elif defined(Q_OS_ANDROID)
	pHandler = qobject_cast&lt;AStoreKitNativeHandlerInterface*&gt;(
		new AStoreKitAndroidNativeHandler(this)
	);
#elif defined(Q_OS_ANDROID)
	pHandler = qobject_cast&lt;AStoreKitNativeHandlerInterface*&gt;(
		new AStoreKitMacOSNativeHandler(this)
	);
#endif
</code></pre>
<p dir="auto">and</p>
<pre><code>// iOS includes
#if defined(Q_OS_IOS)
#include &lt;astorekitiosnativehandler.h&gt;
#endif

// Android includes
#if defined(Q_OS_ANDROID)
#include &lt;astorekitandroidnativehandler.h&gt;
#endif

// MacOS includes
#if defined(Q_OS_MAC)
#include &lt;astorekitmacosnativehandler.h&gt;
#endif
</code></pre>
<p dir="auto">When compiling, don't see Q_OS_IOS and Q_OS_ANDROID. Working only Q_OS_MAC. The same code with QMake and *.pro files working perfectly. Is there any changes for Qt 6 and CMake? Or it's next one bug?</p>
]]></description><link>https://forum.qt.io/topic/142669/qt-6-and-cmake-platform-dependent-code-not-working-why</link><generator>RSS for Node</generator><lastBuildDate>Fri, 19 Jun 2026 02:34:10 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/142669.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 03 Feb 2023 15:03:39 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Qt 6 and CMake platform dependent code not working. Why? on Fri, 03 Feb 2023 15:10:26 GMT]]></title><description><![CDATA[<p dir="auto">I don't see what this should have to do with qmake or cmake - those defines come from Qt (exactly: qsystemdetection.h, automatically included by qglobal.h) so make sure qglobal.h is included before you use those macros.</p>
]]></description><link>https://forum.qt.io/post/746174</link><guid isPermaLink="true">https://forum.qt.io/post/746174</guid><dc:creator><![CDATA[Christian Ehrlicher]]></dc:creator><pubDate>Fri, 03 Feb 2023 15:10:26 GMT</pubDate></item></channel></rss>