Qt 6.11 is out! See what's new in the release
blog
Qt 6 and CMake platform dependent code not working. Why?
-
Hello!
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:
#if defined(Q_OS_MAC) pHandler = qobject_cast<AStoreKitNativeHandlerInterface*>( new AStoreKitIOSNativeHandler(this) ); #elif defined(Q_OS_ANDROID) pHandler = qobject_cast<AStoreKitNativeHandlerInterface*>( new AStoreKitAndroidNativeHandler(this) ); #elif defined(Q_OS_ANDROID) pHandler = qobject_cast<AStoreKitNativeHandlerInterface*>( new AStoreKitMacOSNativeHandler(this) ); #endifand
// iOS includes #if defined(Q_OS_IOS) #include <astorekitiosnativehandler.h> #endif // Android includes #if defined(Q_OS_ANDROID) #include <astorekitandroidnativehandler.h> #endif // MacOS includes #if defined(Q_OS_MAC) #include <astorekitmacosnativehandler.h> #endifWhen 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?
-
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.