From: Louis Dionne Date: Mon, 21 Mar 2022 17:43:02 +0000 (-0400) Subject: [cmake] Handle iOS, watchOS and tvOS when finding compiler-rt on Apple X-Git-Tag: upstream/15.0.7~12806 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8907302f88e7e345ce01eabc77462eefaf9a269c;p=platform%2Fupstream%2Fllvm.git [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 --- diff --git a/cmake/Modules/HandleCompilerRT.cmake b/cmake/Modules/HandleCompilerRT.cmake index 51409d6f..a55984c 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()