I'm trying to use QtCreator (2.7.2) + QT (5.1.0) to build an application that runs on both desktop (Linux) and mobile (Android) platforms.
To achieve this, I need to use different pre-built libraries depending on the target platform. How do I specify this in the .pro file?
The wizard only offers linux/mac/windows as platform choice like
unix:!mac {
message("* Using settings for Unix/Linux.")
LIBS += -L/path/to/linux/libs
}
I've tried
android {
message("* Using settings for Android.")
LIBS += -L/path/to/android/libs
}
But with both build targets only the unix:!mac
gets executed/evaluated.
So my question is: How to detect the build target (called "Kits" now in QtCreator) in the .pro file and change library definitions accordingly?
I've so far only found out how to specify the platform (which seems to be the platform I'm building ON and not FOR) or the build variant RELEASE/DEBUG.
Other things I've found say I should prefix the LIB+=
with the target platform like win32:LIB+=
. But again, this won't work with android
. Maybe I'm using a wrong syntax for the platform (android 4.2 on an arm-v7).
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
}
I'm using this in a .pro file, maybe it 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
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With