[CMake] Updating Xcode Toolchain creation to support Xcode 7

Recent changes to Xcode have changed the structure of Xcode toolchains. This patch makes the xcode-toolchain goop construct a new-format Xcode toolchain that is compatible with Xcode 7.

The new format has a compatibility version key, so when a new format comes out we can support multiple formats in parallel.

llvm-svn: 276718
This commit is contained in:
Chris Bieneman 2016-07-26 00:47:52 +00:00
parent c2e3a76330
commit 1bc83a692d

View File

@ -52,19 +52,20 @@ if(NOT toolchains_match)
endif()
set(toolchains_dir ${CMAKE_MATCH_1})
set(XcodeDefaultInfo "${toolchains_dir}/XcodeDefault.xctoolchain/ToolchainInfo.plist")
set(LLVMToolchainDir "${CMAKE_INSTALL_PREFIX}/Toolchains/LLVM${PACKAGE_VERSION}.xctoolchain/")
add_custom_command(OUTPUT ${LLVMToolchainDir}
COMMAND ${CMAKE_COMMAND} -E make_directory ${LLVMToolchainDir})
add_custom_command(OUTPUT ${LLVMToolchainDir}/ToolchainInfo.plist
add_custom_command(OUTPUT ${LLVMToolchainDir}/Info.plist
DEPENDS ${LLVMToolchainDir}
COMMAND ${CMAKE_COMMAND} -E copy "${XcodeDefaultInfo}" "${LLVMToolchainDir}/ToolchainInfo.plist"
COMMAND /usr/libexec/PlistBuddy -c "Set:Identifier org.llvm.${PACKAGE_VERSION}" "${LLVMToolchainDir}/ToolchainInfo.plist")
COMMAND ${CMAKE_COMMAND} -E remove ${LLVMToolchainDir}/Info.plist
COMMAND /usr/libexec/PlistBuddy -c "Add:CFBundleIdentifier string org.llvm.${PACKAGE_VERSION}" "${LLVMToolchainDir}/Info.plist"
COMMAND /usr/libexec/PlistBuddy -c "Add:CompatibilityVersion integer 1" "${LLVMToolchainDir}/Info.plist"
)
add_custom_target(install-xcode-toolchain
DEPENDS ${LLVMToolchainDir}/ToolchainInfo.plist
DEPENDS ${LLVMToolchainDir}/Info.plist
COMMAND "${CMAKE_COMMAND}" --build ${CMAKE_BINARY_DIR} --target all
COMMAND "${CMAKE_COMMAND}"
-DCMAKE_INSTALL_PREFIX=${LLVMToolchainDir}/usr/
@ -77,7 +78,7 @@ if(LLVM_DISTRIBUTION_COMPONENTS)
endif()
add_custom_target(install-distribution-toolchain
DEPENDS ${LLVMToolchainDir}/ToolchainInfo.plist distribution)
DEPENDS ${LLVMToolchainDir}/Info.plist distribution)
foreach(target ${LLVM_DISTRIBUTION_COMPONENTS})
add_custom_target(install-distribution-${target}