llvm.org GIT mirror llvm / a1a34e5
Doing some cleanup to the iOS toolchain. * There is no reason to require SDKROOT as an environment variable because we can derive it from xcrun * Setting CMAKE_RANLIB makes our static archives usable git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232053 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Bieneman 4 years ago
1 changed file(s) with 23 addition(s) and 9 deletion(s). Raw diff Collapse all Expand all
1414 SET(DARWIN_TARGET_OS_NAME ios)
1515
1616 IF(NOT DEFINED ENV{SDKROOT})
17 MESSAGE(FATAL_ERROR "SDKROOT env var must be set: " $ENV{SDKROOT})
18 ENDIF()
19
20 IF(EXISTS $ENV{SDKROOT})
21 SET(SDKROOT $ENV{SDKROOT})
17 execute_process(COMMAND xcodebuild -version -sdk iphoneos Path
18 OUTPUT_VARIABLE SDKROOT
19 ERROR_QUIET
20 OUTPUT_STRIP_TRAILING_WHITESPACE)
2221 ELSE()
2322 execute_process(COMMAND xcodebuild -version -sdk $ENV{SDKROOT} Path
2423 OUTPUT_VARIABLE SDKROOT
2625 OUTPUT_STRIP_TRAILING_WHITESPACE)
2726 ENDIF()
2827
28 IF(NOT EXISTS ${SDKROOT})
29 MESSAGE(FATAL_ERROR "SDKROOT could not be detected!")
30 ENDIF()
31
32 set(CMAKE_OSX_SYSROOT ${SDKROOT})
33
2934 IF(NOT CMAKE_C_COMPILER)
30 execute_process(COMMAND xcrun -sdk $ENV{SDKROOT} -find clang
35 execute_process(COMMAND xcrun -sdk ${SDKROOT} -find clang
3136 OUTPUT_VARIABLE CMAKE_C_COMPILER
3237 ERROR_QUIET
3338 OUTPUT_STRIP_TRAILING_WHITESPACE)
3540 ENDIF()
3641
3742 IF(NOT CMAKE_CXX_COMPILER)
38 execute_process(COMMAND xcrun -sdk $ENV{SDKROOT} -find clang++
43 execute_process(COMMAND xcrun -sdk ${SDKROOT} -find clang++
3944 OUTPUT_VARIABLE CMAKE_CXX_COMPILER
4045 ERROR_QUIET
4146 OUTPUT_STRIP_TRAILING_WHITESPACE)
4348 ENDIF()
4449
4550 IF(NOT CMAKE_AR)
46 execute_process(COMMAND xcrun -sdk $ENV{SDKROOT} -find ar
51 execute_process(COMMAND xcrun -sdk ${SDKROOT} -find ar
4752 OUTPUT_VARIABLE CMAKE_AR_val
4853 ERROR_QUIET
4954 OUTPUT_STRIP_TRAILING_WHITESPACE)
5156 message(STATUS "Using ar ${CMAKE_AR}")
5257 ENDIF()
5358
59 IF(NOT CMAKE_RANLIB)
60 execute_process(COMMAND xcrun -sdk ${SDKROOT} -find ranlib
61 OUTPUT_VARIABLE CMAKE_RANLIB_val
62 ERROR_QUIET
63 OUTPUT_STRIP_TRAILING_WHITESPACE)
64 SET(CMAKE_RANLIB ${CMAKE_RANLIB_val} CACHE FILEPATH "Ranlib")
65 message(STATUS "Using ranlib ${CMAKE_RANLIB}")
66 ENDIF()
67
5468 IF (NOT DEFINED IOS_MIN_TARGET)
55 execute_process(COMMAND xcodebuild -sdk $ENV{SDKROOT} -version SDKVersion
69 execute_process(COMMAND xcodebuild -sdk ${SDKROOT} -version SDKVersion
5670 OUTPUT_VARIABLE IOS_MIN_TARGET
5771 ERROR_QUIET
5872 OUTPUT_STRIP_TRAILING_WHITESPACE)