Post

Replies

Boosts

Views

Activity

Multiple Xcode Targets with same SPM dependency
I have a library added to my project added as a SPM dependeny. My project has multiple targets that the main app is dependent on. However, a target won't compile without linking to the static library. But if mulitple targets need to reference it, it is included in each target giving runtime warnings that it doesn't know which version to use.Is there a way for multiple targets included in a master target to reference a static package generated by SPM?The only I can think of is to create a framework target that includes the static package, and then link to that from all the modules. But that defeates the whole idea of SPM generating static libraries.
4
0
10k
Sep ’19
redefinition of module with Xcode 11
I've got a decent size project with 10 or so dependencies. I've just switched to Xcode 11 and moved all the modules I can from using Carthage to the new SPM support in Xcode.One of my dependencies is https://github.com/iwasrobbed/Down.git a common markdown parser. It includes libcmark, a C library. After cleaning my build folder, the only module map is./SourcePackages/checkouts/Down/Source/cmark/include/module.modulemapThe first build works, but now find returns./SourcePackages/checkouts/Down/Source/cmark/include/module.modulemap ./Build/Intermediates.noindex/Down.build/Debug/libcmark.build/libcmark.modulemapAfter making a change to the source code and recompiling, the same two modulemaps are there, but I get the error/Users/mlilback/Library/Developer/Xcode/DerivedData/Rc2Client-bqmhvrpuhrtqjdfbdeqbqzhmotdc/Build/Intermediates.noindex/GeneratedModuleMaps/macosx/libcmark.modulemap:1:8: error: redefinition of module 'libcmark' module libcmark { ^ /Users/mlilback/Library/Developer/Xcode/DerivedData/Rc2Client-bqmhvrpuhrtqjdfbdeqbqzhmotdc/SourcePackages/checkouts/Down/Source/cmark/include/module.modulemap:1:8: note: previously defined here module libcmark [system][extern_c] { ^This makes no sense to me. Why does it compile the first time? What can I do to avoid constantly having to clean the build folder and wait for a fresh build?
3
0
12k
Sep ’19