<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/147858>147858</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
CMake fails on mlir when building for Xcode
</td>
</tr>
<tr>
<th>Labels</th>
<td>
mlir
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
Iritscen
</td>
</tr>
</table>
<pre>
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.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyUVN-P4jYQ_mvMyyhRcAKBhzyEhZxo2eMEtL17Qo4zJO45NrKdZfnvKzvs9rpVVZ2ERDw_vhl_83mYtaJViAWZrchsPWGD67QptkY4y1FNat3ciz86VCCsHYRqwXXCAtd9z1RD0hLIPOE9-44QraAehGyir1w3CNEnIJSGb0IpREeQ8qWHaL3b_f583nwuV7vN-cth_8vm6XQk6ZpQyiVTLUlX4T9yWksb4aszjKSrXgoTcNZPz-Wvm_Pqt-1ufT59-7Ih6XqN9dB-gC6Px83htN1_9uD7qnrP3B-_no_fjof9_hTKZoQuXrkZFESRbb5Dz7i2r_7Q6Zu3RFfmOkKXZJ6QpCRJuYUW3UgEGqMNSb3Vu8dfUj49e0Y23glCAaHViFE5TWjliYiuRv-J3BFajVerhOJy8GS9GdaCyTGiNCJkbw-EVgF7J6yzsXt1Y204dQh8sE73b7OBFhUa5oRqx67_p4sfZhcitLQ_31s47K92o4bexl0sFH8UFxaYc4x32IDT0A_SiatEcMy06OyDwqQEAHjebQ9vSFvFP6Hyjn9aHZoL4_i3P-TWgwOlFYK-gOvQYqgbKNEKGryialDx-8MP2nVoCF1YQpcxwMmPVFhQ2gU4JqW-YQP1PUSPwiaUKryNWgd7tw57Qmn8QQEkKQ_Y6xf_ZAilb_K9GP1fb2CsZmHUjtNwNZojNmAHztHayyDl_Ycmb8J1j-AXNFZoBWmcTuM8njRF2izTJZtgMc1ndJrMsnQ56QrGsmYxzRdzfplf2GKeN5dFTXFKkWb1Ms8moqAJnSV5sqTpLJ8uY0bzLGvyJEuncz6fzUmWYM-EjL16Ym3aid8LWEyzfDFbTCSrUdqwTN7v7NeKKYLa6qG1JEtkEO87ghNOYjHe5MKEtKAV-GS4-cUTiPY0XrQZRzAZjCw6565BNrQitGqF64Y65rp_KPvfAg-Nek0_en0p6F8BAAD__7s_l-k">