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)
9 if(NOT CMAKE_OSX_SYSROOT)
10 execute_process(COMMAND xcodebuild -version -sdk iphoneos Path
11 OUTPUT_VARIABLE SDKROOT
13 OUTPUT_STRIP_TRAILING_WHITESPACE)
15 IF(NOT EXISTS ${SDKROOT})
16 MESSAGE(FATAL_ERROR "SDKROOT could not be detected!")
19 message(STATUS "Using SDKROOT ${SDKROOT}")
20 set(CMAKE_OSX_SYSROOT ${SDKROOT})
23 IF(NOT CMAKE_C_COMPILER)
24 execute_process(COMMAND xcrun -sdk ${CMAKE_OSX_SYSROOT} -find clang
25 OUTPUT_VARIABLE CMAKE_C_COMPILER
27 OUTPUT_STRIP_TRAILING_WHITESPACE)
28 message(STATUS "Using c compiler ${CMAKE_C_COMPILER}")
31 IF(NOT CMAKE_CXX_COMPILER)
32 execute_process(COMMAND xcrun -sdk ${CMAKE_OSX_SYSROOT} -find clang++
33 OUTPUT_VARIABLE CMAKE_CXX_COMPILER
35 OUTPUT_STRIP_TRAILING_WHITESPACE)
36 message(STATUS "Using c compiler ${CMAKE_CXX_COMPILER}")
40 execute_process(COMMAND xcrun -sdk ${CMAKE_OSX_SYSROOT} -find ar
41 OUTPUT_VARIABLE CMAKE_AR_val
43 OUTPUT_STRIP_TRAILING_WHITESPACE)
44 SET(CMAKE_AR ${CMAKE_AR_val} CACHE FILEPATH "Archiver")
45 message(STATUS "Using ar ${CMAKE_AR}")
49 execute_process(COMMAND xcrun -sdk ${CMAKE_OSX_SYSROOT} -find ranlib
50 OUTPUT_VARIABLE CMAKE_RANLIB_val
52 OUTPUT_STRIP_TRAILING_WHITESPACE)
53 SET(CMAKE_RANLIB ${CMAKE_RANLIB_val} CACHE FILEPATH "Ranlib")
54 message(STATUS "Using ranlib ${CMAKE_RANLIB}")
58 execute_process(COMMAND xcrun -sdk ${CMAKE_OSX_SYSROOT} -find strip
59 OUTPUT_VARIABLE CMAKE_STRIP_val
61 OUTPUT_STRIP_TRAILING_WHITESPACE)
62 SET(CMAKE_STRIP ${CMAKE_STRIP_val} CACHE FILEPATH "Strip")
63 message(STATUS "Using strip ${CMAKE_STRIP}")
66 IF(NOT CMAKE_DSYMUTIL)
67 execute_process(COMMAND xcrun -sdk ${CMAKE_OSX_SYSROOT} -find dsymutil
68 OUTPUT_VARIABLE CMAKE_DSYMUTIL_val
70 OUTPUT_STRIP_TRAILING_WHITESPACE)
71 SET(CMAKE_DSYMUTIL ${CMAKE_DSYMUTIL_val} CACHE FILEPATH "Dsymutil")
72 message(STATUS "Using dsymutil ${CMAKE_DSYMUTIL}")
76 execute_process(COMMAND xcrun -sdk ${CMAKE_OSX_SYSROOT} -find libtool
77 OUTPUT_VARIABLE CMAKE_LIBTOOL_val
79 OUTPUT_STRIP_TRAILING_WHITESPACE)
80 SET(CMAKE_LIBTOOL ${CMAKE_LIBTOOL_val} CACHE FILEPATH "Libtool")
81 message(STATUS "Using libtool ${CMAKE_LIBTOOL}")
84 IF(NOT CMAKE_CODESIGN)
85 execute_process(COMMAND xcrun -sdk ${CMAKE_OSX_SYSROOT} -find codesign
86 OUTPUT_VARIABLE CMAKE_CODESIGN_val
88 OUTPUT_STRIP_TRAILING_WHITESPACE)
89 SET(CMAKE_CODESIGN ${CMAKE_CODESIGN_val} CACHE FILEPATH "Codesign")
90 message(STATUS "Using codesign ${CMAKE_CODESIGN}")
93 IF(NOT CMAKE_CODESIGN_ALLOCATE)
95 COMMAND xcrun -sdk ${CMAKE_OSX_SYSROOT} -find codesign_allocate
96 OUTPUT_VARIABLE CMAKE_CODESIGN_ALLOCATE_val
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}")