[llvm] r232053 - Doing some cleanup to the iOS toolchain.
Chris Bieneman
beanz at apple.com
Thu Mar 12 09:19:17 PDT 2015
Author: cbieneman
Date: Thu Mar 12 11:19:16 2015
New Revision: 232053
URL: http://llvm.org/viewvc/llvm-project?rev=232053&view=rev
Log:
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
Modified:
llvm/trunk/cmake/platforms/iOS.cmake
Modified: llvm/trunk/cmake/platforms/iOS.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/platforms/iOS.cmake?rev=232053&r1=232052&r2=232053&view=diff
==============================================================================
--- llvm/trunk/cmake/platforms/iOS.cmake (original)
+++ llvm/trunk/cmake/platforms/iOS.cmake Thu Mar 12 11:19:16 2015
@@ -15,11 +15,10 @@ SET(CMAKE_C_COMPILER_WORKS True)
SET(DARWIN_TARGET_OS_NAME ios)
IF(NOT DEFINED ENV{SDKROOT})
- MESSAGE(FATAL_ERROR "SDKROOT env var must be set: " $ENV{SDKROOT})
-ENDIF()
-
-IF(EXISTS $ENV{SDKROOT})
- SET(SDKROOT $ENV{SDKROOT})
+ execute_process(COMMAND xcodebuild -version -sdk iphoneos Path
+ OUTPUT_VARIABLE SDKROOT
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
ELSE()
execute_process(COMMAND xcodebuild -version -sdk $ENV{SDKROOT} Path
OUTPUT_VARIABLE SDKROOT
@@ -27,8 +26,14 @@ ELSE()
OUTPUT_STRIP_TRAILING_WHITESPACE)
ENDIF()
+IF(NOT EXISTS ${SDKROOT})
+ MESSAGE(FATAL_ERROR "SDKROOT could not be detected!")
+ENDIF()
+
+set(CMAKE_OSX_SYSROOT ${SDKROOT})
+
IF(NOT CMAKE_C_COMPILER)
- execute_process(COMMAND xcrun -sdk $ENV{SDKROOT} -find clang
+ execute_process(COMMAND xcrun -sdk ${SDKROOT} -find clang
OUTPUT_VARIABLE CMAKE_C_COMPILER
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
@@ -36,7 +41,7 @@ IF(NOT CMAKE_C_COMPILER)
ENDIF()
IF(NOT CMAKE_CXX_COMPILER)
- execute_process(COMMAND xcrun -sdk $ENV{SDKROOT} -find clang++
+ execute_process(COMMAND xcrun -sdk ${SDKROOT} -find clang++
OUTPUT_VARIABLE CMAKE_CXX_COMPILER
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
@@ -44,7 +49,7 @@ IF(NOT CMAKE_CXX_COMPILER)
ENDIF()
IF(NOT CMAKE_AR)
- execute_process(COMMAND xcrun -sdk $ENV{SDKROOT} -find ar
+ execute_process(COMMAND xcrun -sdk ${SDKROOT} -find ar
OUTPUT_VARIABLE CMAKE_AR_val
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
@@ -52,8 +57,17 @@ IF(NOT CMAKE_AR)
message(STATUS "Using ar ${CMAKE_AR}")
ENDIF()
+IF(NOT CMAKE_RANLIB)
+ execute_process(COMMAND xcrun -sdk ${SDKROOT} -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()
+
IF (NOT DEFINED IOS_MIN_TARGET)
-execute_process(COMMAND xcodebuild -sdk $ENV{SDKROOT} -version SDKVersion
+execute_process(COMMAND xcodebuild -sdk ${SDKROOT} -version SDKVersion
OUTPUT_VARIABLE IOS_MIN_TARGET
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
More information about the llvm-commits
mailing list