I noticed that if you build a CMake project on macOS using -GNinja, you will not get dSYM files on debug builds.
Are there any clever ways to get dSYM files when using the ninja generator?
You won't get them if you do set(CMAKE_XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT "dwarf-with-dsym")
because that's XCode only.
One way around this I tried was to override cmake's add_library
/ add_executable
and insert a custom command to call dsymutil
post build. However, this is undesirable, as it doesn't seem to work when your project uses IMPORTED libraries.
This is an open issue on the CMake issue tracker since 2020. The issue description offers the following snippet, which may be an acceptable workaround until CMake natively supports dsymutil.
I'm not sure how this interacts with IMPORTED libraries.