[compiler-rt] 7b67e96 - [compiler-rt] Fix cross-compiling detection
Hau Hsu via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 29 22:17:49 PDT 2023
Author: Hau Hsu
Date: 2023-03-30T13:15:51+08:00
New Revision: 7b67e965d97aaa353185d17b5802eeaa28110c53
URL: https://github.com/llvm/llvm-project/commit/7b67e965d97aaa353185d17b5802eeaa28110c53
DIFF: https://github.com/llvm/llvm-project/commit/7b67e965d97aaa353185d17b5802eeaa28110c53.diff
LOG: [compiler-rt] Fix cross-compiling detection
Previously the detection compares "CMAKE_SYSTEM_NAME" and
"CMAKE_TARGET_SYSTEM_NAME", which only contains OS names like "Linux".
This is not sufficient when cross-compiling for different target CPUs.
This patch uses CMAKE_CROSSCOMPILING, which sets automatically by CMake
when cross compiling.
Reviewed By: smeenai, phosek
Differential Revision: https://reviews.llvm.org/D147103
Added:
Modified:
compiler-rt/CMakeLists.txt
Removed:
################################################################################
diff --git a/compiler-rt/CMakeLists.txt b/compiler-rt/CMakeLists.txt
index 8a13508fcb98..c5a7b2478e50 100644
--- a/compiler-rt/CMakeLists.txt
+++ b/compiler-rt/CMakeLists.txt
@@ -162,7 +162,7 @@ pythonize_bool(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR)
# We support running instrumented tests when we're not cross-compiling
# and target a UNIX-like system or Windows.
# We can run tests on Android even when we are cross-compiling.
-if(("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "${CMAKE_SYSTEM_NAME}" AND (UNIX OR WIN32))
+if((NOT "${CMAKE_CROSSCOMPILING}" AND (UNIX OR WIN32))
OR ANDROID OR COMPILER_RT_EMULATOR)
option(COMPILER_RT_CAN_EXECUTE_TESTS "Can we execute instrumented tests" ON)
else()
More information about the llvm-commits
mailing list