Files
swift-mirror/cmake/modules/SwiftDarwin.cmake
Michael Gottesman e5ce27ca32 [lto] Make sure to use lipo from the toolchain ${SWIFT_DARWIN_XCRUN_TOOLCHAIN}.
Otherwise, we may get lipo from the wrong toolchain and it may not be
able to understand all of the architectures/bit code we are lipoing
together yielding an unknown architecture error.

rdar://24717107
2016-05-01 13:12:01 -07:00

21 lines
863 B
CMake

# On Darwin platforms that have xcrun, returns the path to the
# default toolchain directory.
function(get_default_toolchain_dir result_var_name)
execute_process(
COMMAND "xcrun" "--toolchain" "default" "--find" "clang"
OUTPUT_VARIABLE toolchain_dir
OUTPUT_STRIP_TRAILING_WHITESPACE)
get_filename_component(toolchain_dir "${toolchain_dir}" PATH)
get_filename_component(toolchain_dir "${toolchain_dir}" PATH)
get_filename_component(toolchain_dir "${toolchain_dir}" PATH)
set("${result_var_name}" "${toolchain_dir}" PARENT_SCOPE)
endfunction()
function(find_toolchain_tool result_var_name toolchain tool)
execute_process(
COMMAND "xcrun" "--toolchain" "${toolchain}" "--find" "${tool}"
OUTPUT_VARIABLE tool_path
OUTPUT_STRIP_TRAILING_WHITESPACE)
set("${result_var_name}" "${tool_path}" PARENT_SCOPE)
endfunction()