summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZack Galbreath <zack.galbreath@kitware.com>2017-02-03 15:44:51 -0500
committerBrad King <brad.king@kitware.com>2017-02-04 08:16:24 -0500
commit8a5cb84b0e5ef3deac4e241d0d4f3e9932daadaa (patch)
tree5ba23334f8cda3268c322759dec2ae1939a5ea6c
parent9d34e51cdb7ccc74eaf851f1784433616bc9c31a (diff)
downloadcmake-8a5cb84b0e5ef3deac4e241d0d4f3e9932daadaa.tar.gz
AndroidTestUtilities: do not require ExternalData unconditionally
Attempting to use AndroidTestUtilities to simply install some local files on device can result in the following error: Neither ExternalData_URL_TEMPLATES nor ExternalData_OBJECT_STORES is set We no longer require these ExternalData-specific variables to be set if no such remote data files are requested. Fixes: #16529
-rw-r--r--Modules/AndroidTestUtilities.cmake17
-rw-r--r--Tests/RunCMake/AndroidTestUtilities/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/AndroidTestUtilities/SetupTest4.cmake13
-rw-r--r--Tests/RunCMake/AndroidTestUtilities/SetupTest4Build-check.cmake5
4 files changed, 31 insertions, 5 deletions
diff --git a/Modules/AndroidTestUtilities.cmake b/Modules/AndroidTestUtilities.cmake
index a0a74fa647..62d04f3eff 100644
--- a/Modules/AndroidTestUtilities.cmake
+++ b/Modules/AndroidTestUtilities.cmake
@@ -110,11 +110,18 @@ function(android_add_test_data test_name)
endforeach()
set(DATA_TARGET_NAME "${test_name}")
- ExternalData_Expand_Arguments(
- ${DATA_TARGET_NAME}
- extern_data_output
- ${AST_FILES})
- ExternalData_Add_Target(${DATA_TARGET_NAME})
+ string(FIND "${AST_FILES}" "DATA{" data_files_found)
+ if(${data_files_found} GREATER "-1")
+ # Use ExternalData if any DATA{} files were found.
+ ExternalData_Expand_Arguments(
+ ${DATA_TARGET_NAME}
+ extern_data_output
+ ${AST_FILES})
+ ExternalData_Add_Target(${DATA_TARGET_NAME})
+ else()
+ add_custom_target(${DATA_TARGET_NAME} ALL)
+ set(extern_data_output ${AST_FILES})
+ endif()
# For regular files on Linux, just copy them directly.
foreach(path ${AST_FILES})
diff --git a/Tests/RunCMake/AndroidTestUtilities/RunCMakeTest.cmake b/Tests/RunCMake/AndroidTestUtilities/RunCMakeTest.cmake
index f0ae24b2fe..7d031d4c03 100644
--- a/Tests/RunCMake/AndroidTestUtilities/RunCMakeTest.cmake
+++ b/Tests/RunCMake/AndroidTestUtilities/RunCMakeTest.cmake
@@ -18,3 +18,4 @@ endfunction()
run_ATU(SetupTest1 "")
run_ATU(SetupTest2 "tests")
run_ATU(SetupTest3 "tests")
+run_ATU(SetupTest4 "")
diff --git a/Tests/RunCMake/AndroidTestUtilities/SetupTest4.cmake b/Tests/RunCMake/AndroidTestUtilities/SetupTest4.cmake
new file mode 100644
index 0000000000..9a27266723
--- /dev/null
+++ b/Tests/RunCMake/AndroidTestUtilities/SetupTest4.cmake
@@ -0,0 +1,13 @@
+enable_testing()
+include(AndroidTestUtilities)
+
+find_program(adb_executable adb)
+
+set(test_files "data/a.txt")
+
+set(ANDROID 1)
+
+android_add_test_data(setup_test
+ FILES ${test_files}
+ DEVICE_TEST_DIR "/data/local/tests/example1"
+ DEVICE_OBJECT_STORE "/sdcard/.ExternalData/SHA")
diff --git a/Tests/RunCMake/AndroidTestUtilities/SetupTest4Build-check.cmake b/Tests/RunCMake/AndroidTestUtilities/SetupTest4Build-check.cmake
new file mode 100644
index 0000000000..ef7569d65a
--- /dev/null
+++ b/Tests/RunCMake/AndroidTestUtilities/SetupTest4Build-check.cmake
@@ -0,0 +1,5 @@
+include(${CMAKE_CURRENT_LIST_DIR}/check.cmake)
+compare_build_to_expected(FILES
+ "data/a.txt"
+ )
+check_for_setup_test()