Skip to content

Commit

Permalink
[compiler-rt] Fix cross-compiling detection
Browse files Browse the repository at this point in the history
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
  • Loading branch information
hau-hsu authored and hauhsu committed Mar 30, 2023
1 parent 9f8678b commit 7b67e96
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion compiler-rt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 7b67e96

Please sign in to comment.