diff options
author | Petr Hosek <phosek@chromium.org> | 2018-08-14 18:01:19 +0000 |
---|---|---|
committer | Petr Hosek <phosek@chromium.org> | 2018-08-14 18:01:19 +0000 |
commit | d399f8f96483219ddc1974305e7799db10a0703f (patch) | |
tree | f3b8a4bd652912ba83b5bc8e5451cd87e30058ae /cmake/Modules | |
parent | c43c6b277c15777970a060fd6d705781a471205e (diff) | |
download | compiler-rt-d399f8f96483219ddc1974305e7799db10a0703f.tar.gz |
[CMake] Don't parse target triple except for arch
compiler-rt CMake build currently tries to parse the triple and then
put it back together, but doing so inherently tricky, and doing so
from CMake is just crazy and currently doesn't handle triples that
have more than three components. Fortunatelly, the CMake really only
needs the architecture part, which is typically the first component,
to construct variants for other architectures. This means we can keep
the rest of the triple as is and avoid the parsing altogether.
Differential Revision: https://reviews.llvm.org/D50548
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@339701 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'cmake/Modules')
-rw-r--r-- | cmake/Modules/CompilerRTUtils.cmake | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/cmake/Modules/CompilerRTUtils.cmake b/cmake/Modules/CompilerRTUtils.cmake index c3f2237d8..d8996a675 100644 --- a/cmake/Modules/CompilerRTUtils.cmake +++ b/cmake/Modules/CompilerRTUtils.cmake @@ -276,11 +276,6 @@ macro(construct_compiler_rt_default_triple) string(REPLACE "-" ";" TARGET_TRIPLE_LIST ${COMPILER_RT_DEFAULT_TARGET_TRIPLE}) list(GET TARGET_TRIPLE_LIST 0 COMPILER_RT_DEFAULT_TARGET_ARCH) - list(GET TARGET_TRIPLE_LIST 1 COMPILER_RT_DEFAULT_TARGET_OS) - list(LENGTH TARGET_TRIPLE_LIST TARGET_TRIPLE_LIST_LENGTH) - if(TARGET_TRIPLE_LIST_LENGTH GREATER 2) - list(GET TARGET_TRIPLE_LIST 2 COMPILER_RT_DEFAULT_TARGET_ABI) - endif() # Determine if test target triple is specified explicitly, and doesn't match the # default. if(NOT COMPILER_RT_DEFAULT_TARGET_TRIPLE STREQUAL TARGET_TRIPLE) @@ -320,13 +315,12 @@ function(filter_builtin_sources output_var exclude_or_include excluded_list) endfunction() function(get_compiler_rt_target arch variable) + string(FIND ${COMPILER_RT_DEFAULT_TARGET_TRIPLE} "-" dash_index) + string(SUBSTRING ${COMPILER_RT_DEFAULT_TARGET_TRIPLE} ${dash_index} -1 triple_suffix) if(ANDROID AND ${arch} STREQUAL "i386") - set(target "i686${COMPILER_RT_OS_SUFFIX}-${COMPILER_RT_DEFAULT_TARGET_OS}") + set(target "i686${COMPILER_RT_OS_SUFFIX}${triple_suffix}") else() - set(target "${arch}-${COMPILER_RT_DEFAULT_TARGET_OS}") - endif() - if(COMPILER_RT_DEFAULT_TARGET_ABI) - set(target "${target}-${COMPILER_RT_DEFAULT_TARGET_ABI}") + set(target "${arch}${triple_suffix}") endif() set(${variable} ${target} PARENT_SCOPE) endfunction() |