Skip to content
This repository has been archived by the owner on Apr 28, 2022. It is now read-only.

Commit

Permalink
android_add_test: add regular test if platform is not Android
Browse files Browse the repository at this point in the history
  • Loading branch information
ruslo committed Dec 28, 2016
1 parent 9708402 commit bcf8e23
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions AndroidApk.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,8 @@ endfunction()
##################################################
## FUNCTION: android_add_test
##
## Run test on device (similar to add_test)
## Run test on device (similar to add_test). If platform is not Android just
## add regular test.
##
## @param NAME
## Name of the test
Expand All @@ -556,13 +557,6 @@ endfunction()
##################################################

function(android_add_test)
if(HUNTER_ENABLED)
hunter_add_package(Android-SDK)
set(ADB_COMMAND "${ANDROID-SDK_ROOT}/android-sdk/platform-tools/adb")
else()
set(ADB_COMMAND "adb")
endif()

# Introduce:
# * x_NAME
# * x_COMMAND
Expand All @@ -573,6 +567,18 @@ function(android_add_test)
message(FATAL_ERROR "Unparsed: ${x_UNPARSED_ARGUMENTS}")
endif()

if(NOT ANDROID)
add_test(NAME ${x_NAME} COMMAND ${x_COMMAND})
return()
endif()

if(HUNTER_ENABLED)
hunter_add_package(Android-SDK)
set(ADB_COMMAND "${ANDROID-SDK_ROOT}/android-sdk/platform-tools/adb")
else()
set(ADB_COMMAND "adb")
endif()

list(GET x_COMMAND 0 app_target)
if(NOT TARGET "${app_target}")
message(
Expand Down

0 comments on commit bcf8e23

Please sign in to comment.