Skip to content

Commit 94ceaf8

Browse files
committed
Build only Qt Quick and Widgets applications as library on Android
This way e.g. `syncthingctl` is still built as an actual CLI app. It is still not really usable but it makes more sense than a library.
1 parent baca670 commit 94ceaf8

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

cmake/modules/AppTarget.cmake

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,18 @@ endif ()
3232
append_user_defined_additional_libraries()
3333

3434
# add target for building the application
35+
set(AS_LIBRARY FALSE)
3536
if (ANDROID)
3637
# create a shared library which can be loaded from the Java-side, needs to be a module target to avoid
3738
# "QT_ANDROID_GENERATE_DEPLOYMENT_SETTINGS only works on Module targets" when using
3839
# `qt_android_generate_deployment_settings`.
40+
if ("GUI_QTQUICK" IN_LIST META_PRIVATE_COMPILE_DEFINITIONS)
41+
set(AS_LIBRARY TRUE)
42+
elseif ("GUI_QTWIDGETS" IN_LIST META_PRIVATE_COMPILE_DEFINITIONS)
43+
set(AS_LIBRARY TRUE)
44+
endif ()
45+
endif ()
46+
if (AS_LIBRARY)
3947
add_library(${META_TARGET_NAME} MODULE ${ALL_FILES})
4048
# set suffix to avoid "Cannot find application binary in build dir …/lib…_arm64-v8a.so." when using
4149
# `qt_android_add_apk_target`.

0 commit comments

Comments
 (0)