summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorLouis Dionne <ldionne.2@gmail.com>2022-03-21 13:43:02 -0400
committerLouis Dionne <ldionne.2@gmail.com>2022-03-21 21:55:09 -0400
commit8907302f88e7e345ce01eabc77462eefaf9a269c (patch)
treeb46eea92196ae4bccb1ece7a562633edddea4119 /cmake
parent7f7f4be78abcad4558367b22693ea55cfc5bb547 (diff)
downloadllvm-8907302f88e7e345ce01eabc77462eefaf9a269c.tar.gz
[cmake] Handle iOS, watchOS and tvOS when finding compiler-rt on Apple
This patch uses CMAKE_OSX_SYSROOT, which should contain the SDK path that we're building against on Apple platforms, to determine which platform we are compiling for and set the compiler-rt suffix accordingly. Differential Revision: https://reviews.llvm.org/D122161
Diffstat (limited to 'cmake')
-rw-r--r--cmake/Modules/HandleCompilerRT.cmake22
1 files changed, 20 insertions, 2 deletions
diff --git a/cmake/Modules/HandleCompilerRT.cmake b/cmake/Modules/HandleCompilerRT.cmake
index 51409d6f97f2..a55984c67e1c 100644
--- a/cmake/Modules/HandleCompilerRT.cmake
+++ b/cmake/Modules/HandleCompilerRT.cmake
@@ -20,8 +20,26 @@ function(get_component_name name variable)
if(NOT name MATCHES "builtins.*")
set(component_name "${name}_")
endif()
- # TODO: Support ios, tvos and watchos as well.
- set(component_name "${component_name}osx")
+ if (CMAKE_OSX_SYSROOT MATCHES ".+MacOSX.+")
+ set(component_name "${component_name}osx")
+
+ elseif (CMAKE_OSX_SYSROOT MATCHES ".+iPhoneOS.+")
+ set(component_name "${component_name}ios")
+ elseif (CMAKE_OSX_SYSROOT MATCHES ".+iPhoneSimulator.+")
+ set(component_name "${component_name}iossim")
+
+ elseif (CMAKE_OSX_SYSROOT MATCHES ".+AppleTVOS.+")
+ set(component_name "${component_name}tvos")
+ elseif (CMAKE_OSX_SYSROOT MATCHES ".+AppleTVSimulator.+")
+ set(component_name "${component_name}tvossim")
+
+ elseif (CMAKE_OSX_SYSROOT MATCHES ".+WatchOS.+")
+ set(component_name "${component_name}watchos")
+ elseif (CMAKE_OSX_SYSROOT MATCHES ".+WatchSimulator.+")
+ set(component_name "${component_name}watchossim")
+ else()
+ message(FATAL_ERROR "Unknown Apple SDK ${CMAKE_OSX_SYSROOT}, we don't know which compiler-rt library suffix to use.")
+ endif()
else()
set(component_name "${name}")
endif()