summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2019-09-12 18:44:47 +0000
committerReid Kleckner <rnk@google.com>2019-09-12 18:44:47 +0000
commitcce679fa55e11b6474ecd40f8cfdb3e044306f8c (patch)
tree63e303a7b56b842e0e7a1deead0469bfff0b05fc
parent35386e756449da9e348acf22a85f8d142a424016 (diff)
downloadcompiler-rt-cce679fa55e11b6474ecd40f8cfdb3e044306f8c.tar.gz
Use host's executable suffix for clang when cross-compiling compiler-rt
When cross-compiling compiler-rt as part of LLVM e. g. for Linux on a Windows host and using the just-built clang as cross-compiler, we set the -DBUILTINS_CMAKE_ARGS="-DCMAKE_SYSTEM_NAME=Linux" flag in top-level cmake invocation, which causes CMAKE_EXECUTABLE_SUFFIX to be an empty string in the nested cmake invocation for building builtins. But the compiler for compiling test cases is meant to be run on host, therefore it may have the '.exe' suffix. Handle this by asking cmake about the host system. Patch by Sergej Jaskiewicz <jaskiewiczs@icloud.com> Reviewed By: rnk Differential Revision: https://reviews.llvm.org/D67401 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@371754 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--cmake/base-config-ix.cmake14
1 files changed, 12 insertions, 2 deletions
diff --git a/cmake/base-config-ix.cmake b/cmake/base-config-ix.cmake
index b85720ead..b4b87aa53 100644
--- a/cmake/base-config-ix.cmake
+++ b/cmake/base-config-ix.cmake
@@ -47,11 +47,21 @@ if (LLVM_TREE_AVAILABLE)
${LLVM_INCLUDE_TESTS})
option(COMPILER_RT_ENABLE_WERROR "Fail and stop if warning is triggered"
${LLVM_ENABLE_WERROR})
+
# Use just-built Clang to compile/link tests on all platforms.
+ if (CMAKE_CROSSCOMPILING)
+ if (CMAKE_HOST_WIN32)
+ set(_host_executable_suffix ".exe")
+ else()
+ set(_host_executable_suffix "")
+ endif()
+ else()
+ set(_host_executable_suffix ${CMAKE_EXECUTABLE_SUFFIX})
+ endif()
set(COMPILER_RT_TEST_COMPILER
- ${LLVM_RUNTIME_OUTPUT_INTDIR}/clang${CMAKE_EXECUTABLE_SUFFIX})
+ ${LLVM_RUNTIME_OUTPUT_INTDIR}/clang${_host_executable_suffix})
set(COMPILER_RT_TEST_CXX_COMPILER
- ${LLVM_RUNTIME_OUTPUT_INTDIR}/clang++${CMAKE_EXECUTABLE_SUFFIX})
+ ${LLVM_RUNTIME_OUTPUT_INTDIR}/clang++${_host_executable_suffix})
else()
# Take output dir and install path from the user.
set(COMPILER_RT_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR} CACHE PATH