diff --git a/cmake/Modules/HandleCompilerRT.cmake b/cmake/Modules/HandleCompilerRT.cmake --- a/cmake/Modules/HandleCompilerRT.cmake +++ b/cmake/Modules/HandleCompilerRT.cmake @@ -20,8 +20,17 @@ 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 ".+AppleTVOS.+") + set(component_name "${component_name}tvos") + elseif (CMAKE_OSX_SYSROOT MATCHES ".+WatchOS.+") + set(component_name "${component_name}watchos") + 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()