summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-07-25 19:31:34 (GMT)
committerBrad King <brad.king@kitware.com>2019-07-26 18:17:07 (GMT)
commit19f36c5fb2497703e4f071b3a9424a8d121ccef9 (patch)
tree8b2968f6d5ce0472b70abbc1ab3e02abcb838729 /Tests/RunCMake
parentf3e32ddae94919c8dbd3df201ab8491af50dfe44 (diff)
downloadCMake-19f36c5fb2497703e4f071b3a9424a8d121ccef9.zip
CMake-19f36c5fb2497703e4f071b3a9424a8d121ccef9.tar.gz
CMake-19f36c5fb2497703e4f071b3a9424a8d121ccef9.tar.bz2
Android: Update test to not require GCC compiler to exist in NDK
Diffstat (limited to 'Tests/RunCMake')
-rw-r--r--Tests/RunCMake/Android/common.cmake37
1 files changed, 19 insertions, 18 deletions
diff --git a/Tests/RunCMake/Android/common.cmake b/Tests/RunCMake/Android/common.cmake
index aaa7c89..d96ab86 100644
--- a/Tests/RunCMake/Android/common.cmake
+++ b/Tests/RunCMake/Android/common.cmake
@@ -6,8 +6,6 @@ if(NOT ANDROID)
endif()
foreach(f
- "${CMAKE_C_ANDROID_TOOLCHAIN_PREFIX}gcc${CMAKE_C_ANDROID_TOOLCHAIN_SUFFIX}"
- "${CMAKE_CXX_ANDROID_TOOLCHAIN_PREFIX}g++${CMAKE_CXX_ANDROID_TOOLCHAIN_SUFFIX}"
"${CMAKE_CXX_ANDROID_TOOLCHAIN_PREFIX}ar${CMAKE_CXX_ANDROID_TOOLCHAIN_SUFFIX}"
"${CMAKE_CXX_ANDROID_TOOLCHAIN_PREFIX}ld${CMAKE_CXX_ANDROID_TOOLCHAIN_SUFFIX}"
)
@@ -51,23 +49,26 @@ elseif(CMAKE_ANDROID_STANDALONE_TOOLCHAIN)
endif()
endif()
-execute_process(
- COMMAND "${CMAKE_C_ANDROID_TOOLCHAIN_PREFIX}gcc${CMAKE_C_ANDROID_TOOLCHAIN_SUFFIX}" -dumpmachine
- OUTPUT_VARIABLE _out OUTPUT_STRIP_TRAILING_WHITESPACE
- ERROR_VARIABLE _err
- RESULT_VARIABLE _res
- )
-if(NOT _res EQUAL 0)
- message(SEND_ERROR "Failed to run 'gcc -dumpmachine':\n ${_res}")
-endif()
-string(REPLACE "--" "-" _out_check "${_out}")
-if(NOT _out_check STREQUAL "${CMAKE_C_ANDROID_TOOLCHAIN_MACHINE}"
- AND NOT (_out STREQUAL "arm--linux-android" AND CMAKE_C_ANDROID_TOOLCHAIN_MACHINE STREQUAL "arm-linux-androideabi"))
- message(SEND_ERROR "'gcc -dumpmachine' produced:\n"
- " ${_out}\n"
- "which does not match CMAKE_C_ANDROID_TOOLCHAIN_MACHINE:\n"
- " ${CMAKE_C_ANDROID_TOOLCHAIN_MACHINE}"
+set(gcc ${CMAKE_C_ANDROID_TOOLCHAIN_PREFIX}gcc${CMAKE_C_ANDROID_TOOLCHAIN_SUFFIX})
+if(EXISTS "${gcc}")
+ execute_process(
+ COMMAND "${CMAKE_C_ANDROID_TOOLCHAIN_PREFIX}gcc${CMAKE_C_ANDROID_TOOLCHAIN_SUFFIX}" -dumpmachine
+ OUTPUT_VARIABLE _out OUTPUT_STRIP_TRAILING_WHITESPACE
+ ERROR_VARIABLE _err
+ RESULT_VARIABLE _res
)
+ if(NOT _res EQUAL 0)
+ message(SEND_ERROR "Failed to run 'gcc -dumpmachine':\n ${_res}")
+ endif()
+ string(REPLACE "--" "-" _out_check "${_out}")
+ if(NOT _out_check STREQUAL "${CMAKE_C_ANDROID_TOOLCHAIN_MACHINE}"
+ AND NOT (_out STREQUAL "arm--linux-android" AND CMAKE_C_ANDROID_TOOLCHAIN_MACHINE STREQUAL "arm-linux-androideabi"))
+ message(SEND_ERROR "'gcc -dumpmachine' produced:\n"
+ " ${_out}\n"
+ "which does not match CMAKE_C_ANDROID_TOOLCHAIN_MACHINE:\n"
+ " ${CMAKE_C_ANDROID_TOOLCHAIN_MACHINE}"
+ )
+ endif()
endif()
if(CMAKE_ANDROID_STL_TYPE STREQUAL "none")