Install android packages via cmake
Found a nice way to install some android packages via cmake:
For a working example see my repository on github
set(ANDROID_SDK_TOOL android)
#
# Install android packages
#
# parameters:
# PACKAGE The package id that you need to install
#
macro(cp_android_package PACKAGE)
message(STATUS "install android sdk package ${PACKAGE}")
file(WRITE ${CMAKE_BINARY_DIR}/yes.txt "y")
execute_process(
COMMAND ${ANDROID_SDK_TOOL} list target -c
OUTPUT_VARIABLE TARGETS_LIST
)
if (${TARGETS_LIST} MATCHES ${PACKAGE})
message(STATUS "${PACKAGE} is already installed")
else()
execute_process(
COMMAND ${ANDROID_SDK_TOOL} update sdk -a -u -s -t ${PACKAGE}
INPUT_FILE ${CMAKE_BINARY_DIR}/yes.txt
)
endif()
endmacro()
Call it with: cp_android_package("android-13") cp_android_package("android-16") cp_android_package("extra-google-google_play_services") cp_android_package("platform-tools")
For a working example see my repository on github
Kommentare
Kommentar veröffentlichen