Index: llvm/trunk/CMakeLists.txt =================================================================== --- llvm/trunk/CMakeLists.txt +++ llvm/trunk/CMakeLists.txt @@ -40,6 +40,12 @@ "host compiler, pass -Thost=x64 on the CMake command line.") endif() +if (CMAKE_GENERATOR STREQUAL "Xcode" AND NOT CMAKE_OSX_ARCHITECTURES) + # Some CMake features like object libraries get confused if you don't + # explicitly specify an architecture setting with the Xcode generator. + set(CMAKE_OSX_ARCHITECTURES "x86_64") +endif() + project(LLVM VERSION ${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH} LANGUAGES C CXX ASM) Index: llvm/trunk/cmake/modules/AddLLVM.cmake =================================================================== --- llvm/trunk/cmake/modules/AddLLVM.cmake +++ llvm/trunk/cmake/modules/AddLLVM.cmake @@ -433,7 +433,12 @@ ${ALL_FILES} ) llvm_update_compile_flags(${obj_name}) - set(ALL_FILES "$") + if(CMAKE_GENERATOR STREQUAL "Xcode") + set(DUMMY_FILE ${CMAKE_CURRENT_BINARY_DIR}/Dummy.c) + file(WRITE ${DUMMY_FILE} "// This file intentionally empty\n") + set_property(SOURCE ${DUMMY_FILE} APPEND_STRING PROPERTY COMPILE_FLAGS "-Wno-empty-translation-unit") + endif() + set(ALL_FILES "$" ${DUMMY_FILE}) # Do add_dependencies(obj) later due to CMake issue 14747. list(APPEND objlibs ${obj_name})