1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 11:42:57 +01:00
llvm-mirror/cmake/platforms/iOS.cmake
Justin Bogner dec93a4fca cmake: Simplify the iOS.cmake toolchain
- Remove a comment that was clearly copy pasted from Android.cmake and
  isn't relevant.
- Remove the toolchain's sensitivity to the environment. It's less
  error prone to just allow users to set CMAKE_OSX_SYSROOT if they
  want to use a custom SDK.
- Stop explicitly setting -mios-version-min to the default value. It
  just adds needless complexity.

This makes building the native tablegen work for me even when SDKROOT
is set in the environment (or passed in as -DCMAKE_OSX_SYSROOT).

llvm-svn: 260763
2016-02-12 23:36:05 +00:00

55 lines
1.6 KiB
CMake

# Toolchain config for iOS.
SET(CMAKE_SYSTEM_NAME Darwin)
SET(CMAKE_SYSTEM_VERSION 13)
SET(CMAKE_CXX_COMPILER_WORKS True)
SET(CMAKE_C_COMPILER_WORKS True)
if(NOT CMAKE_OSX_SYSROOT)
execute_process(COMMAND xcodebuild -version -sdk iphoneos Path
OUTPUT_VARIABLE SDKROOT
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
IF(NOT EXISTS ${SDKROOT})
MESSAGE(FATAL_ERROR "SDKROOT could not be detected!")
ENDIF()
message(STATUS "Using SDKROOT ${SDKROOT}")
set(CMAKE_OSX_SYSROOT ${SDKROOT})
endif()
IF(NOT CMAKE_C_COMPILER)
execute_process(COMMAND xcrun -sdk ${CMAKE_OSX_SYSROOT} -find clang
OUTPUT_VARIABLE CMAKE_C_COMPILER
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
message(STATUS "Using c compiler ${CMAKE_C_COMPILER}")
ENDIF()
IF(NOT CMAKE_CXX_COMPILER)
execute_process(COMMAND xcrun -sdk ${CMAKE_OSX_SYSROOT} -find clang++
OUTPUT_VARIABLE CMAKE_CXX_COMPILER
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
message(STATUS "Using c compiler ${CMAKE_CXX_COMPILER}")
ENDIF()
IF(NOT CMAKE_AR)
execute_process(COMMAND xcrun -sdk ${CMAKE_OSX_SYSROOT} -find ar
OUTPUT_VARIABLE CMAKE_AR_val
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
SET(CMAKE_AR ${CMAKE_AR_val} CACHE FILEPATH "Archiver")
message(STATUS "Using ar ${CMAKE_AR}")
ENDIF()
IF(NOT CMAKE_RANLIB)
execute_process(COMMAND xcrun -sdk ${CMAKE_OSX_SYSROOT} -find ranlib
OUTPUT_VARIABLE CMAKE_RANLIB_val
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
SET(CMAKE_RANLIB ${CMAKE_RANLIB_val} CACHE FILEPATH "Ranlib")
message(STATUS "Using ranlib ${CMAKE_RANLIB}")
ENDIF()