# dSYM file not copied when archiving

**URL:** https://discourse.cmake.org/t/dsym-file-not-copied-when-archiving/7691
**Category:** Code
**Tags:** os:macos, gen:xcode, os:ios
**Created:** [March 16, 2023, 4:18pm UTC](https://discourse.cmake.org/t/dsym-file-not-copied-when-archiving/7691 "2023-03-16T16:18:00Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![m\_g](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/m/ce7236/32.png) [@m\_g](https://discourse.cmake.org/u/m_g)
#### Post date: [March 16, 2023, 4:18pm UTC](https://discourse.cmake.org/t/dsym-file-not-copied-when-archiving/7691/1 "2023-03-16T16:18:00Z")

</div>

Hi,

I use CMake to generate iOS/macOS Xcode projects for an app.

When archiving to upload beta builds to TestFlight, the `dSYMs`directory in the `.xcarchive` is simply empty.

The dSYM file is properly generated but it seems it’s not copied into the archive folder.

I tried various flags combinations in my `CMakeLists.txt` but so far I can’t get it to work properly.

So far I have :

```auto
set_target_properties(${TARGET_NAME} PROPERTIES
    # [...] other non-related properties
    XCODE_ATTRIBUTE_SKIP_INSTALL "NO"
    XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT "dwarf-with-dsym"
    XCODE_ATTRIBUTE_GCC_GENERATE_DEBUGGING_SYMBOLS "YES"
    XCODE_ATTRIBUTE_DEPLOYMENT_POSTPROCESSING "YES"
    XCODE_ATTRIBUTE_ENABLE_STDEBUG_INFORMATION_FORMAT "dwarf-with-dsym"
    #XCODE_ATTRIBUTE_DWARF_DSYM_FILE_SHOULD_ACCOMPANY_PRODUCT "YES"

```

The dSYM is properly created in the current CMake build artifacts directory, it’s just not copied in the archive.

Also, when I set `XCODE_ATTRIBUTE_DWARF_DSYM_FILE_SHOULD_ACCOMPANY_PRODUCT` to `YES`, the archive is somewhat corrupt but the dSYM file is included right where the .app file is, which isn’t even where it should be placed.

I’m using CMake 3.26.0 and Xcode 14.2 on a Mac M1 running macOS Ventura 13.2.1.

What am I missing ?

Thanks in advance!

---

<div class="post-metadata">

### Author: ![m\_g](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/m/ce7236/32.png) [@m\_g](https://discourse.cmake.org/u/m_g)
#### Post date: [March 16, 2023, 5:52pm UTC](https://discourse.cmake.org/t/dsym-file-not-copied-when-archiving/7691/2 "2023-03-16T17:52:59Z")

</div>

Update. Adding this will fix the dSYM issue :

```auto
XCODE_ATTRIBUTE_CONFIGURATION_BUILD_DIR "$(inherited)"

```

Hope this helps someone else !

Cheers.
