[lldb] Fix LLDB_DEFAULT_TEST_ARCH for standalone builds
authorJonas Devlieghere <jonas@devlieghere.com>
Thu, 23 Jul 2020 00:03:09 +0000 (17:03 -0700)
committerJonas Devlieghere <jonas@devlieghere.com>
Thu, 23 Jul 2020 00:04:42 +0000 (17:04 -0700)
LLVM_TARGET_ARCH is not exported by LLVM so we can't use it from
standalone builds. Default to the architecture in LLVM_HOST_TRIPLE when
no LLDB_DEFAULT_TEST_ARCH was specified.

lldb/test/API/CMakeLists.txt

index 34f3522c8dfec80e8d9eddea05b47b16335a73b0..a80992f287e9e56c96c8a2c113181a2c5e1f01fe 100644 (file)
@@ -13,10 +13,10 @@ function(add_python_test_target name test_script args comment)
   add_dependencies(${name} lldb-test-deps)
 endfunction()
 
-# The default architecture with which to compile test executables is the default LLVM target
-# architecture, which itself defaults to the host architecture.
-string(TOLOWER "${LLVM_TARGET_ARCH}" LLDB_DEFAULT_TEST_ARCH)
-if( LLDB_DEFAULT_TEST_ARCH STREQUAL "host" )
+# The default architecture with which to compile test executables is the
+# default LLVM target architecture, which itself defaults to the host
+# architecture.
+if(NOT LLDB_DEFAULT_TEST_ARCH)
   string(REGEX MATCH "^[^-]*" LLDB_DEFAULT_TEST_ARCH ${LLVM_HOST_TRIPLE})
 endif ()