File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed
Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -67,7 +67,7 @@ include(CMakeParseArguments)
6767macro (add_qt_android_apk TARGET SOURCE_TARGET)
6868
6969 # parse the macro arguments
70- cmake_parse_arguments (ARG "INSTALL" "NAME;VERSION_CODE;PACKAGE_NAME;PACKAGE_SOURCES;KEYSTORE_PASSWORD" "DEPENDS;KEYSTORE" ${ARGN} )
70+ cmake_parse_arguments (ARG "INSTALL" "NAME;VERSION_CODE;PACKAGE_NAME;PACKAGE_SOURCES;KEYSTORE_PASSWORD" "DEPENDS;KEYSTORE;APK_BUILD_TYPE " ${ARGN} )
7171
7272 # extract the full path of the source target binary
7373 set (QT_ANDROID_APP_PATH "$<TARGET_FILE:${SOURCE_TARGET} >" ) # full file path to the app's main shared library
@@ -277,12 +277,19 @@ macro(add_qt_android_apk TARGET SOURCE_TARGET)
277277 endif ()
278278
279279 # determine the build type to pass to androiddeployqt
280- if ("${CMAKE_BUILD_TYPE} " STREQUAL "Debug" AND NOT ARG_KEYSTORE)
280+ string (STRIP "${ARG_APK_BUILD_TYPE} " ARG_APK_BUILD_TYPE)
281+ string (TOLOWER "${ARG_APK_BUILD_TYPE} " ARG_APK_BUILD_TYPE)
282+ if (NOT ARG_APK_BUILD_TYPE OR "${ARG_APK_BUILD_TYPE} " STREQUAL "auto" )
283+ if ("${CMAKE_BUILD_TYPE} " STREQUAL "Debug" AND NOT ARG_KEYSTORE)
281284 set (QT_ANDROID_BUILD_TYPE --debug)
282- else ()
285+ else ()
283286 set (QT_ANDROID_BUILD_TYPE --release)
284- endif ()
285-
287+ endif ()
288+ elseif ("${ARG_APK_BUILD_TYPE} " STREQUAL "debug" OR "${ARG_APK_BUILD_TYPE} " STREQUAL "release" )
289+ set (QT_ANDROID_BUILD_TYPE "--${ARG_APK_BUILD_TYPE} " )
290+ else ()
291+ message (FATAL_ERROR "Unsupport APK_BUILD_TYPE ${ARG_APK_BUILD_TYPE} " )
292+ endif ()
286293 # create a custom command that will run the androiddeployqt utility to prepare the Android package
287294 add_custom_target (
288295 ${TARGET}
You can’t perform that action at this time.
0 commit comments