aboutsummaryrefslogtreecommitdiffstats
path: root/share/qtcreator/templates
diff options
context:
space:
mode:
authorBogDan Vatra <bogdan@kdab.com>2019-03-06 14:17:17 +0200
committerBogDan Vatra <bogdan@kdab.com>2019-03-06 14:47:27 +0000
commit26463a22190a941a6b1ba2965dfe296747beb0d5 (patch)
tree8826332b93ac003e9008b2ad9b023ec204f99576 /share/qtcreator/templates
parenta8ebc37da2b1461761f2d95975c98fd0987e02db (diff)
Say hello to Android CMake support
Requirements: - NDKr19 or newer - Qt 5.12.1 or newer QtCreator supports the following variables: - ANDROID_PACKAGE_SOURCE_DIR - ANDROID_EXTRA_LIBS Be aware, that there is a lot of magic done on QtCreator side, and you can't use only cmake to build an Android APK. [ChangeLog][Android][CMake] Add Android support for CMake projects. Change-Id: I1d351976ed56f424c2bc972f4ff7b5968147a2ed Reviewed-by: hjk <hjk@qt.io>
Diffstat (limited to 'share/qtcreator/templates')
-rw-r--r--share/qtcreator/templates/wizards/projects/qtquickapplication/CMakeLists.txt18
1 files changed, 17 insertions, 1 deletions
diff --git a/share/qtcreator/templates/wizards/projects/qtquickapplication/CMakeLists.txt b/share/qtcreator/templates/wizards/projects/qtquickapplication/CMakeLists.txt
index f28d772a1a..0b7b832155 100644
--- a/share/qtcreator/templates/wizards/projects/qtquickapplication/CMakeLists.txt
+++ b/share/qtcreator/templates/wizards/projects/qtquickapplication/CMakeLists.txt
@@ -10,6 +10,22 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(Qt5 COMPONENTS Core Quick REQUIRED)
-add_executable(${PROJECT_NAME} "%{MainCppFileName}" "qml.qrc")
+if(ANDROID)
+ add_library(${PROJECT_NAME} SHARED "%{MainCppFileName}" "qml.qrc")
+else()
+ add_executable(${PROJECT_NAME} "%{MainCppFileName}" "qml.qrc")
+endif()
+
target_compile_definitions(${PROJECT_NAME} PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>)
target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Core Qt5::Quick)
+
+# QtCreator supports the following variables for Android, which are identical to qmake Android variables.
+# Check http://doc.qt.io/qt-5/deployment-android.html for more information.
+# These variables must use CACHE, otherwise QtCreator won't see them.
+
+#if(ANDROID)
+# set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android" CACHE INTERNAL "")
+# if (ANDROID_ABI STREQUAL "armeabi-v7a")
+# set(ANDROID_EXTRA_LIBS ${CMAKE_CURRENT_SOURCE_DIR}/path/to/libcrypto.so ${CMAKE_CURRENT_SOURCE_DIR}/path/to/libssl.so CACHE INTERNAL "")
+# endif()
+#endif()