How to specify Android-only libraries in a .pro file?

I am trying to use QtCreator (2.7.2) + QT (5.1.0) to create an application that runs on both desktop (Linux) and mobile (Android) platforms.

To achieve this, I need to use different pre-created libraries depending on the target platform. How to specify this in a .pro file?

The wizard offers only linux / mac / windows as a platform choice, for example

unix:!mac { message("* Using settings for Unix/Linux.") LIBS += -L/path/to/linux/libs } 

I tried

 android { message("* Using settings for Android.") LIBS += -L/path/to/android/libs } 

But for both construction purposes, only unix:!mac execution is performed unix:!mac .

So my question is: how to determine the purpose of the assembly (called "Kits" now in QtCreator) in the .pro file and modify the library definitions accordingly?

So far, I have learned how to specify the platform (which seems to be the platform on which I build ON, not FOR) or the RELEASE / DEBUG build option. Other things I found say that I must prefix LIB+= with the target platform, for example win32:LIB+= . But then again, this will not work with android . Maybe I'm using the wrong syntax for the platform (android 4.2 on arm-v7).

+7
android qt cmake qt-creator
source share
2 answers

this works for me (Qt 5.3.2)

 linux:!android { message("* Using settings for Unix/Linux.") LIBS += -L/path/to/linux/libs } android { message("* Using settings for Android.") LIBS += -L/path/to/android/libs } 
+15
source share

I use this in a .pro file, maybe this helps:

 unix:!macx: { android: { INCLUDEPATH += "/usr/lib/boost/boost_1_47_0" \ inkscape } !android: { INCLUDEPATH += $$(BOOST_PATH) \ inkscape } } macx: { INCLUDEPATH += "../../../../boost_1_54_0" \#$$(BOOST_PATH) \ inkscape } 
+4
source share

All Articles