Loegic Loegic - 1 year ago 357
Swift Question

Define custom module map file in cocoapods Podspec

I made a custom

module map
file to handle the
import in a swift project. (
non-modular include

It's working great if I do it manually, but
won't find / resolve the module when I try to
pod lint
a simple project containing an import from this custom module.

I tried
s.module_map = "module/module.modulemap"
along with

core.xcconfig = { 'HEADER_SEARCH_PATHS' => '$(SDKROOT)/usr/include/libxml2 $(SRCROOT)/module $(SDKROOT)/usr/include/libresolv',

Any help would be appreciated.

Answer Source

I managed to fix this issue by setting the pod_target_xcconfig property. The complete part looks like that :

s.preserve_path = 'module/module.modulemap'
s.module_map = 'module/module.modulemap'

core.pod_target_xcconfig = { 'HEADER_SEARCH_PATHS' => $(PODS_ROOT)/mypod/module }
core.xcconfig = { 'HEADER_SEARCH_PATHS' => '$(SDKROOT)/usr/include/libxml2 $(PODS_ROOT)/mypod/module }