Skip to content

CMake fails on mlir when building for Xcode #147858

Open
@Iritscen

Description

@Iritscen

When issuing this command: cmake -B build-Xcode -G "Xcode" -S llvm -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;mlir" -DCMAKE_BUILD_TYPE=Debug -DLLVM_ENABLE_ASSERTIONS=OFF -DCMAKE_OSX_SYSROOT=$(xcrun --sdk macosx --show-sdk-path)

I get this error:

CMake Error in /path/to/llvm-project/mlir/include/mlir/Dialect/Arith/IR/CMakeLists.txt:
  The custom command generating

    /path/to/llvm-project/build-Xcode/tools/mlir/include/mlir/Dialect/Arith/IR/ArithOpsEnums.h.inc

  is attached to multiple targets:

    MLIRArithOpsIncGen
    MLIRArithOpsInterfacesIncGen

  but none of these is a common dependency of the other(s).  This is not
  allowed by the Xcode "new build system".

Removing "mlir" from -DLLVM_ENABLE_PROJECTS allows CMake to proceed successfully. This is with CMake version 3.31.7.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions