[yaml2obj/obj2yaml] - Add support for .stack_sizes sections.
[llvm-complete.git] / cmake / platforms / iOS.cmake
blobccb06536d354c300cd3a1b3770a5487608a374f6
1 # Toolchain config for iOS.
3 SET(CMAKE_SYSTEM_NAME Darwin)
4 SET(CMAKE_SYSTEM_VERSION 13)
5 SET(CMAKE_CXX_COMPILER_WORKS True)
6 SET(CMAKE_C_COMPILER_WORKS True)
7 SET(IOS True)
9 if(NOT CMAKE_OSX_SYSROOT)
10   execute_process(COMMAND xcodebuild -version -sdk iphoneos Path
11     OUTPUT_VARIABLE SDKROOT
12     ERROR_QUIET
13     OUTPUT_STRIP_TRAILING_WHITESPACE)
15   IF(NOT EXISTS ${SDKROOT})
16     MESSAGE(FATAL_ERROR "SDKROOT could not be detected!")
17   ENDIF()
19   message(STATUS "Using SDKROOT ${SDKROOT}")
20   set(CMAKE_OSX_SYSROOT ${SDKROOT})
21 endif()
23 IF(NOT CMAKE_C_COMPILER)
24   execute_process(COMMAND xcrun -sdk ${CMAKE_OSX_SYSROOT} -find clang
25    OUTPUT_VARIABLE CMAKE_C_COMPILER
26    ERROR_QUIET
27    OUTPUT_STRIP_TRAILING_WHITESPACE)
28   message(STATUS "Using C compiler ${CMAKE_C_COMPILER}")
29 ENDIF()
31 IF(NOT CMAKE_CXX_COMPILER)
32   execute_process(COMMAND xcrun -sdk ${CMAKE_OSX_SYSROOT} -find clang++
33    OUTPUT_VARIABLE CMAKE_CXX_COMPILER
34    ERROR_QUIET
35    OUTPUT_STRIP_TRAILING_WHITESPACE)
36   message(STATUS "Using C++ compiler ${CMAKE_CXX_COMPILER}")
37 ENDIF()
39 IF(NOT CMAKE_AR)
40   execute_process(COMMAND xcrun -sdk ${CMAKE_OSX_SYSROOT} -find ar
41    OUTPUT_VARIABLE CMAKE_AR_val
42    ERROR_QUIET
43    OUTPUT_STRIP_TRAILING_WHITESPACE)
44   SET(CMAKE_AR ${CMAKE_AR_val} CACHE FILEPATH "Archiver")
45   message(STATUS "Using ar ${CMAKE_AR}")
46 ENDIF()
48 IF(NOT CMAKE_RANLIB)
49   execute_process(COMMAND xcrun -sdk ${CMAKE_OSX_SYSROOT} -find ranlib
50    OUTPUT_VARIABLE CMAKE_RANLIB_val
51    ERROR_QUIET
52    OUTPUT_STRIP_TRAILING_WHITESPACE)
53   SET(CMAKE_RANLIB ${CMAKE_RANLIB_val} CACHE FILEPATH "Ranlib")
54   message(STATUS "Using ranlib ${CMAKE_RANLIB}")
55 ENDIF()
57 IF(NOT CMAKE_STRIP)
58   execute_process(COMMAND xcrun -sdk ${CMAKE_OSX_SYSROOT} -find strip
59    OUTPUT_VARIABLE CMAKE_STRIP_val
60    ERROR_QUIET
61    OUTPUT_STRIP_TRAILING_WHITESPACE)
62   SET(CMAKE_STRIP ${CMAKE_STRIP_val} CACHE FILEPATH "Strip")
63   message(STATUS "Using strip ${CMAKE_STRIP}")
64 ENDIF()
66 IF(NOT CMAKE_DSYMUTIL)
67   execute_process(COMMAND xcrun -sdk ${CMAKE_OSX_SYSROOT} -find dsymutil
68    OUTPUT_VARIABLE CMAKE_DSYMUTIL_val
69    ERROR_QUIET
70    OUTPUT_STRIP_TRAILING_WHITESPACE)
71   SET(CMAKE_DSYMUTIL ${CMAKE_DSYMUTIL_val} CACHE FILEPATH "Dsymutil")
72   message(STATUS "Using dsymutil ${CMAKE_DSYMUTIL}")
73 ENDIF()
75 IF(NOT CMAKE_LIBTOOL)
76   execute_process(COMMAND xcrun -sdk ${CMAKE_OSX_SYSROOT} -find libtool
77    OUTPUT_VARIABLE CMAKE_LIBTOOL_val
78    ERROR_QUIET
79    OUTPUT_STRIP_TRAILING_WHITESPACE)
80   SET(CMAKE_LIBTOOL ${CMAKE_LIBTOOL_val} CACHE FILEPATH "Libtool")
81   message(STATUS "Using libtool ${CMAKE_LIBTOOL}")
82 ENDIF()
84 IF(NOT CMAKE_CODESIGN)
85   execute_process(COMMAND xcrun -sdk ${CMAKE_OSX_SYSROOT} -find codesign
86    OUTPUT_VARIABLE CMAKE_CODESIGN_val
87    ERROR_QUIET
88    OUTPUT_STRIP_TRAILING_WHITESPACE)
89   SET(CMAKE_CODESIGN ${CMAKE_CODESIGN_val} CACHE FILEPATH "Codesign")
90   message(STATUS "Using codesign ${CMAKE_CODESIGN}")
91 ENDIF()
93 IF(NOT CMAKE_CODESIGN_ALLOCATE)
94   execute_process(
95     COMMAND xcrun -sdk ${CMAKE_OSX_SYSROOT} -find codesign_allocate
96     OUTPUT_VARIABLE CMAKE_CODESIGN_ALLOCATE_val
97     ERROR_QUIET
98     OUTPUT_STRIP_TRAILING_WHITESPACE)
99   SET(CMAKE_CODESIGN_ALLOCATE ${CMAKE_CODESIGN_ALLOCATE_val} CACHE
100       FILEPATH "Codesign_Allocate")
101   message(STATUS "Using codesign_allocate ${CMAKE_CODESIGN_ALLOCATE}")
102 ENDIF()