diff options
author | Pirama Arumuga Nainar <pirama@google.com> | 2015-04-08 08:55:49 -0700 |
---|---|---|
committer | Pirama Arumuga Nainar <pirama@google.com> | 2015-04-09 15:04:38 -0700 |
commit | 4c5e43da7792f75567b693105cc53e3f1992ad98 (patch) | |
tree | 1b2c9792582e12f5af0b1512e3094425f0dc0df9 /cmake | |
parent | c75239e6119d0f9a74c57099d91cbc9bde56bf33 (diff) | |
download | external_llvm-4c5e43da7792f75567b693105cc53e3f1992ad98.zip external_llvm-4c5e43da7792f75567b693105cc53e3f1992ad98.tar.gz external_llvm-4c5e43da7792f75567b693105cc53e3f1992ad98.tar.bz2 |
Update aosp/master llvm for rebase to r233350
Change-Id: I07d935f8793ee8ec6b7da003f6483046594bca49
Diffstat (limited to 'cmake')
-rwxr-xr-x | cmake/config-ix.cmake | 19 | ||||
-rw-r--r-- | cmake/modules/AddLLVM.cmake | 32 | ||||
-rw-r--r-- | cmake/modules/CheckAtomic.cmake | 1 | ||||
-rw-r--r-- | cmake/modules/CrossCompile.cmake | 88 | ||||
-rw-r--r-- | cmake/modules/HandleLLVMOptions.cmake | 43 | ||||
-rw-r--r-- | cmake/modules/HandleLLVMStdlib.cmake | 26 | ||||
-rw-r--r-- | cmake/modules/LLVM-Config.cmake | 4 | ||||
-rw-r--r-- | cmake/modules/TableGen.cmake | 10 | ||||
-rw-r--r-- | cmake/platforms/iOS.cmake | 32 |
9 files changed, 175 insertions, 80 deletions
diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake index d646498..c57f900 100755 --- a/cmake/config-ix.cmake +++ b/cmake/config-ix.cmake @@ -137,20 +137,6 @@ check_symbol_exists(getpagesize unistd.h HAVE_GETPAGESIZE) check_symbol_exists(getrusage sys/resource.h HAVE_GETRUSAGE) check_symbol_exists(setrlimit sys/resource.h HAVE_SETRLIMIT) check_symbol_exists(isatty unistd.h HAVE_ISATTY) -check_symbol_exists(isinf cmath HAVE_ISINF_IN_CMATH) -check_symbol_exists(isinf math.h HAVE_ISINF_IN_MATH_H) -check_symbol_exists(finite ieeefp.h HAVE_FINITE_IN_IEEEFP_H) -check_symbol_exists(isnan cmath HAVE_ISNAN_IN_CMATH) -check_symbol_exists(isnan math.h HAVE_ISNAN_IN_MATH_H) -check_symbol_exists(ceilf math.h HAVE_CEILF) -check_symbol_exists(floorf math.h HAVE_FLOORF) -check_symbol_exists(fmodf math.h HAVE_FMODF) -check_symbol_exists(log math.h HAVE_LOG) -check_symbol_exists(log2 math.h HAVE_LOG2) -check_symbol_exists(log10 math.h HAVE_LOG10) -check_symbol_exists(exp math.h HAVE_EXP) -check_symbol_exists(exp2 math.h HAVE_EXP2) -check_symbol_exists(exp10 math.h HAVE_EXP10) check_symbol_exists(futimens sys/stat.h HAVE_FUTIMENS) check_symbol_exists(futimes sys/time.h HAVE_FUTIMES) if( HAVE_SETJMP_H ) @@ -162,7 +148,6 @@ endif() if( HAVE_SYS_UIO_H ) check_symbol_exists(writev sys/uio.h HAVE_WRITEV) endif() -check_symbol_exists(nearbyintf math.h HAVE_NEARBYINTF) check_symbol_exists(mallctl malloc_np.h HAVE_MALLCTL) check_symbol_exists(mallinfo malloc.h HAVE_MALLINFO) check_symbol_exists(malloc_zone_statistics malloc/malloc.h @@ -547,6 +532,10 @@ if(GOLD_EXECUTABLE) "PATH to binutils/include containing plugin-api.h for gold plugin.") endif() +if(APPLE) + find_program(LD64_EXECUTABLE NAMES ld DOC "The ld64 linker") +endif() + include(FindOCaml) include(AddOCaml) if(WIN32) diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake index 7f63644..50cee30 100644 --- a/cmake/modules/AddLLVM.cmake +++ b/cmake/modules/AddLLVM.cmake @@ -338,10 +338,10 @@ function(llvm_add_library name) PREFIX "" ) endif() - + set_target_properties(${name} PROPERTIES - SOVERSION ${LLVM_VERSION_MAJOR} + SOVERSION ${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR} VERSION ${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}${LLVM_VERSION_SUFFIX}) endif() @@ -490,6 +490,12 @@ macro(add_llvm_executable name) endif( LLVM_COMMON_DEPENDS ) endmacro(add_llvm_executable name) +function(export_executable_symbols target) + if (NOT MSVC) # MSVC's linker doesn't support exporting all symbols. + set_target_properties(${target} PROPERTIES ENABLE_EXPORTS 1) + endif() +endfunction() + set (LLVM_TOOLCHAIN_TOOLS llvm-ar @@ -780,3 +786,25 @@ function(add_lit_testsuite target comment) ARGS ${ARG_ARGS} ) endfunction() + +function(add_lit_testsuites project directory) + if (NOT CMAKE_CONFIGURATION_TYPES) + parse_arguments(ARG "PARAMS;DEPENDS;ARGS" "" ${ARGN}) + file(GLOB_RECURSE litCfg ${directory}/lit*.cfg) + foreach(f ${litCfg}) + get_filename_component(dir ${f} DIRECTORY) + string(REPLACE ${directory} "" name_slash ${dir}) + if (name_slash) + string(REPLACE "/" "-" name_slash ${name_slash}) + string(REPLACE "\\" "-" name_dashes ${name_slash}) + string(TOLOWER "${project}${name_dashes}" name_var) + add_lit_target("check-${name_var}" "Running lit suite ${dir}" + ${dir} + PARAMS ${ARG_PARAMS} + DEPENDS ${ARG_DEPENDS} + ARGS ${ARG_ARGS} + ) + endif() + endforeach() + endif() +endfunction() diff --git a/cmake/modules/CheckAtomic.cmake b/cmake/modules/CheckAtomic.cmake index 30a5e31..a03788e 100644 --- a/cmake/modules/CheckAtomic.cmake +++ b/cmake/modules/CheckAtomic.cmake @@ -13,6 +13,7 @@ endif() CHECK_CXX_SOURCE_COMPILES(" #ifdef _MSC_VER +#include <Intrin.h> /* Workaround for PR19898. */ #include <windows.h> #endif int main() { diff --git a/cmake/modules/CrossCompile.cmake b/cmake/modules/CrossCompile.cmake index 400381c..76a3078 100644 --- a/cmake/modules/CrossCompile.cmake +++ b/cmake/modules/CrossCompile.cmake @@ -1,33 +1,55 @@ -if(NOT DEFINED LLVM_NATIVE_BUILD) - set(LLVM_NATIVE_BUILD "${CMAKE_BINARY_DIR}/native") - message(STATUS "Setting native build dir to ${LLVM_NATIVE_BUILD}") -endif(NOT DEFINED LLVM_NATIVE_BUILD) - -add_custom_command(OUTPUT ${LLVM_NATIVE_BUILD} - COMMAND ${CMAKE_COMMAND} -E make_directory ${LLVM_NATIVE_BUILD} - COMMENT "Creating ${LLVM_NATIVE_BUILD}...") - -add_custom_command(OUTPUT ${LLVM_NATIVE_BUILD}/CMakeCache.txt - COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" ${CMAKE_SOURCE_DIR} - WORKING_DIRECTORY ${LLVM_NATIVE_BUILD} - DEPENDS ${LLVM_NATIVE_BUILD} - COMMENT "Configuring native LLVM...") - -add_custom_target(ConfigureNativeLLVM DEPENDS ${LLVM_NATIVE_BUILD}/CMakeCache.txt) - -set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES ${LLVM_NATIVE_BUILD}) - -if(NOT IS_DIRECTORY ${LLVM_NATIVE_BUILD}) - if(${CMAKE_HOST_SYSTEM_NAME} MATCHES "Darwin") - set(HOST_SYSROOT_FLAGS -DCMAKE_OSX_SYSROOT=macosx) - endif(${CMAKE_HOST_SYSTEM_NAME} MATCHES "Darwin") - - message(STATUS "Configuring native build...") - execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory - ${LLVM_NATIVE_BUILD} ) - - message(STATUS "Configuring native targets...") - execute_process(COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=Release - -G "${CMAKE_GENERATOR}" -DLLVM_TARGETS_TO_BUILD=${LLVM_TARGETS_TO_BUILD} ${HOST_SYSROOT_FLAGS} ${CMAKE_SOURCE_DIR} - WORKING_DIRECTORY ${LLVM_NATIVE_BUILD} ) -endif(NOT IS_DIRECTORY ${LLVM_NATIVE_BUILD}) +function(llvm_create_cross_target_internal target_name toochain buildtype) + + if(NOT DEFINED LLVM_${target_name}_BUILD) + set(LLVM_${target_name}_BUILD "${CMAKE_BINARY_DIR}/${target_name}") + set(LLVM_${target_name}_BUILD ${LLVM_${target_name}_BUILD} PARENT_SCOPE) + message(STATUS "Setting native build dir to " ${LLVM_${target_name}_BUILD}) + endif(NOT DEFINED LLVM_${target_name}_BUILD) + + if (EXISTS ${LLVM_MAIN_SRC_DIR}/cmake/platforms/${toolchain}.cmake) + set(CROSS_TOOLCHAIN_FLAGS_${target_name} + -DCMAKE_TOOLCHAIN_FILE=\"${LLVM_MAIN_SRC_DIR}/cmake/platforms/${toolchain}.cmake\" + CACHE STRING "Toolchain file for ${target_name}") + endif() + + add_custom_command(OUTPUT ${LLVM_${target_name}_BUILD} + COMMAND ${CMAKE_COMMAND} -E make_directory ${LLVM_${target_name}_BUILD} + COMMENT "Creating ${LLVM_${target_name}_BUILD}...") + + add_custom_command(OUTPUT ${LLVM_${target_name}_BUILD}/CMakeCache.txt + COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" + ${CROSS_TOOLCHAIN_FLAGS_${target_name}} ${CMAKE_SOURCE_DIR} + WORKING_DIRECTORY ${LLVM_${target_name}_BUILD} + DEPENDS ${LLVM_${target_name}_BUILD} + COMMENT "Configuring ${target_name} LLVM...") + + add_custom_target(CONFIGURE_LLVM_${target_name} + DEPENDS ${LLVM_${target_name}_BUILD}/CMakeCache.txt) + + set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES + ${LLVM_${target_name}_BUILD}) + + if(NOT IS_DIRECTORY ${LLVM_${target_name}_BUILD}) + + + message(STATUS "Configuring ${target_name} build...") + execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory + ${LLVM_${target_name}_BUILD} ) + + message(STATUS "Configuring ${target_name} targets...") + if (buildtype) + set(build_type_flags "-DCMAKE_BUILD_TYPE=${buildtype}") + endif() + execute_process(COMMAND ${CMAKE_COMMAND} ${build_type_flags} + -G "${CMAKE_GENERATOR}" -DLLVM_TARGETS_TO_BUILD=${LLVM_TARGETS_TO_BUILD} + ${CROSS_TOOLCHAIN_FLAGS_${target_name}} ${CMAKE_SOURCE_DIR} + WORKING_DIRECTORY ${LLVM_${target_name}_BUILD} ) + endif(NOT IS_DIRECTORY ${LLVM_${target_name}_BUILD}) + +endfunction() + +function(llvm_create_cross_target target_name sysroot) + llvm_create_cross_target_internal(${target_name} ${sysroot} ${CMAKE_BUILD_TYPE}) +endfunction() + +llvm_create_cross_target_internal(NATIVE "" Release) diff --git a/cmake/modules/HandleLLVMOptions.cmake b/cmake/modules/HandleLLVMOptions.cmake index fdc4ea0..67f86a6 100644 --- a/cmake/modules/HandleLLVMOptions.cmake +++ b/cmake/modules/HandleLLVMOptions.cmake @@ -78,6 +78,20 @@ if( LLVM_ENABLE_ASSERTIONS ) endif() endif() +string(TOUPPER "${LLVM_ABI_BREAKING_CHECKS}" uppercase_LLVM_ABI_BREAKING_CHECKS) + +if( uppercase_LLVM_ABI_BREAKING_CHECKS STREQUAL "WITH_ASSERTS" ) + if( LLVM_ENABLE_ASSERTIONS ) + set( LLVM_ENABLE_ABI_BREAKING_CHECKS 1 ) + endif() +elseif( uppercase_LLVM_ABI_BREAKING_CHECKS STREQUAL "FORCE_ON" ) + set( LLVM_ENABLE_ABI_BREAKING_CHECKS 1 ) +elseif( uppercase_LLVM_ABI_BREAKING_CHECKS STREQUAL "FORCE_OFF" ) + # We don't need to do anything special to turn off ABI breaking checks. +else() + message(FATAL_ERROR "Unknown value for LLVM_ABI_BREAKING_CHECKS: \"${LLVM_ABI_BREAKING_CHECKS}\"!") +endif() + if(WIN32) set(LLVM_HAVE_LINK_VERSION_SCRIPT 0) if(CYGWIN) @@ -253,7 +267,9 @@ if( MSVC ) -D_CRT_NONSTDC_NO_WARNINGS -D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS + ) + set(msvc_warning_flags # Disabled warnings. -wd4146 # Suppress 'unary minus operator applied to unsigned type, result still unsigned' -wd4180 # Suppress 'qualifier applied to function type has no meaning; ignored' @@ -272,6 +288,22 @@ if( MSVC ) -wd4624 # Suppress ''derived class' : destructor could not be generated because a base class destructor is inaccessible' -wd4722 # Suppress 'function' : destructor never returns, potential memory leak -wd4800 # Suppress ''type' : forcing value to bool 'true' or 'false' (performance warning)' + -wd4100 # Suppress 'unreferenced formal parameter' + -wd4127 # Suppress 'conditional expression is constant' + -wd4512 # Suppress 'assignment operator could not be generated' + -wd4505 # Suppress 'unreferenced local function has been removed' + -wd4610 # Suppress '<class> can never be instantiated' + -wd4510 # Suppress 'default constructor could not be generated' + -wd4702 # Suppress 'unreachable code' + -wd4245 # Suppress 'signed/unsigned mismatch' + -wd4706 # Suppress 'assignment within conditional expression' + -wd4310 # Suppress 'cast truncates constant value' + -wd4701 # Suppress 'potentially uninitialized local variable' + -wd4703 # Suppress 'potentially uninitialized local pointer variable' + -wd4389 # Suppress 'signed/unsigned mismatch' + -wd4611 # Suppress 'interaction between '_setjmp' and C++ object destruction is non-portable' + -wd4805 # Suppress 'unsafe mix of type <type> and type <type> in operation' + -wd4204 # Suppress 'nonstandard extension used : non-constant aggregate initializer' # Promoted warnings. -w14062 # Promote 'enumerator in switch of enum is not handled' to level 1 warning. @@ -282,14 +314,19 @@ if( MSVC ) # Enable warnings if (LLVM_ENABLE_WARNINGS) - add_llvm_definitions( /W4 ) + append("/W4" msvc_warning_flags) if (LLVM_ENABLE_PEDANTIC) # No MSVC equivalent available endif (LLVM_ENABLE_PEDANTIC) endif (LLVM_ENABLE_WARNINGS) if (LLVM_ENABLE_WERROR) - add_llvm_definitions( /WX ) + append("/WX" msvc_warning_flags) endif (LLVM_ENABLE_WERROR) + + foreach(flag ${msvc_warning_flags}) + append("${flag}" CMAKE_C_FLAGS CMAKE_CXX_FLAGS) + endforeach(flag) + elseif( LLVM_COMPILER_IS_GCC_COMPATIBLE ) if (LLVM_ENABLE_WARNINGS) append("-Wall -W -Wno-unused-parameter -Wwrite-strings" CMAKE_C_FLAGS CMAKE_CXX_FLAGS) @@ -424,7 +461,7 @@ if(LLVM_USE_SANITIZER) message(WARNING "LLVM_USE_SANITIZER is not supported on this platform.") endif() if (LLVM_USE_SANITIZE_COVERAGE) - append("-fsanitize-coverage=4" CMAKE_C_FLAGS CMAKE_CXX_FLAGS) + append("-fsanitize-coverage=4 -mllvm -sanitizer-coverage-8bit-counters=1" CMAKE_C_FLAGS CMAKE_CXX_FLAGS) endif() endif() diff --git a/cmake/modules/HandleLLVMStdlib.cmake b/cmake/modules/HandleLLVMStdlib.cmake index 47bb6cd..66ad078 100644 --- a/cmake/modules/HandleLLVMStdlib.cmake +++ b/cmake/modules/HandleLLVMStdlib.cmake @@ -12,22 +12,28 @@ if(NOT DEFINED LLVM_STDLIB_HANDLED) set(LLVM_COMPILER_IS_GCC_COMPATIBLE ON) endif() - function(append_if condition value) - if(${condition}) - foreach(variable ${ARGN}) - set(${variable} "${${variable}} ${value}" PARENT_SCOPE) - endforeach(variable) - endif() + function(append value) + foreach(variable ${ARGN}) + set(${variable} "${${variable}} ${value}" PARENT_SCOPE) + endforeach(variable) endfunction() include(CheckCXXCompilerFlag) if(LLVM_ENABLE_LIBCXX) if(LLVM_COMPILER_IS_GCC_COMPATIBLE) check_cxx_compiler_flag("-stdlib=libc++" CXX_SUPPORTS_STDLIB) - append_if(CXX_SUPPORTS_STDLIB "-stdlib=libc++" CMAKE_CXX_FLAGS) - append_if(CXX_SUPPORTS_STDLIB "-stdlib=libc++" CMAKE_EXE_LINKER_FLAGS) - append_if(CXX_SUPPORTS_STDLIB "-stdlib=libc++" CMAKE_SHARED_LINKER_FLAGS) - append_if(CXX_SUPPORTS_STDLIB "-stdlib=libc++" CMAKE_MODULE_LINKER_FLAGS) + if(CXX_SUPPORTS_STDLIB) + append("-stdlib=libc++" + CMAKE_CXX_FLAGS CMAKE_EXE_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS + CMAKE_MODULE_LINKER_FLAGS) + if(LLVM_ENABLE_LIBCXXABI) + append("-lc++abi" + CMAKE_EXE_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS + CMAKE_MODULE_LINKER_FLAGS) + endif() + else() + message(WARNING "Can't specify libc++ with '-stdlib='") + endif() else() message(WARNING "Not sure how to specify libc++ for this compiler") endif() diff --git a/cmake/modules/LLVM-Config.cmake b/cmake/modules/LLVM-Config.cmake index b24c129..bc0527f 100644 --- a/cmake/modules/LLVM-Config.cmake +++ b/cmake/modules/LLVM-Config.cmake @@ -41,9 +41,9 @@ function(explicit_llvm_config executable) llvm_map_components_to_libnames(LIBRARIES ${link_components}) get_target_property(t ${executable} TYPE) if("x${t}" STREQUAL "xSTATIC_LIBRARY") - target_link_libraries(${executable} ${cmake_2_8_12_INTERFACE} ${LIBRARIES}) + target_link_libraries(${executable} INTERFACE ${LIBRARIES}) elseif("x${t}" STREQUAL "xSHARED_LIBRARY" OR "x${t}" STREQUAL "xMODULE_LIBRARY") - target_link_libraries(${executable} ${cmake_2_8_12_PRIVATE} ${LIBRARIES}) + target_link_libraries(${executable} PRIVATE ${LIBRARIES}) else() # Use plain form for legacy user. target_link_libraries(${executable} ${LIBRARIES}) diff --git a/cmake/modules/TableGen.cmake b/cmake/modules/TableGen.cmake index 67031a5..bb0d844 100644 --- a/cmake/modules/TableGen.cmake +++ b/cmake/modules/TableGen.cmake @@ -91,20 +91,18 @@ macro(add_tablegen target project) # Effective tblgen executable to be used: set(${project}_TABLEGEN_EXE ${${project}_TABLEGEN} PARENT_SCOPE) - if(CMAKE_CROSSCOMPILING) + if(LLVM_USE_HOST_TOOLS) if( ${${project}_TABLEGEN} STREQUAL "${target}" ) set(${project}_TABLEGEN_EXE "${LLVM_NATIVE_BUILD}/bin/${target}") set(${project}_TABLEGEN_EXE ${${project}_TABLEGEN_EXE} PARENT_SCOPE) add_custom_command(OUTPUT ${${project}_TABLEGEN_EXE} - COMMAND ${CMAKE_COMMAND} --build . --target ${target} --config $<CONFIGURATION> - DEPENDS ${LLVM_NATIVE_BUILD}/CMakeCache.txt + COMMAND ${CMAKE_COMMAND} --build . --target ${target} --config Release + DEPENDS CONFIGURE_LLVM_NATIVE ${target} WORKING_DIRECTORY ${LLVM_NATIVE_BUILD} COMMENT "Building native TableGen...") add_custom_target(${project}NativeTableGen DEPENDS ${${project}_TABLEGEN_EXE}) - add_dependencies(${project}NativeTableGen ConfigureNativeLLVM) - - add_dependencies(${target} ${project}NativeTableGen) + add_dependencies(${project}NativeTableGen CONFIGURE_LLVM_NATIVE) endif() endif() diff --git a/cmake/platforms/iOS.cmake b/cmake/platforms/iOS.cmake index e18ca6b..4914059 100644 --- a/cmake/platforms/iOS.cmake +++ b/cmake/platforms/iOS.cmake @@ -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) |