Search code examples
iosswiftcocoapodspodspec

Add custom module to Target build settings in Podspec


I try to add a custom module into my Podspec, but setting: module_map : 'module/module.modulemap'

and in the build settings:

xcconfig = { 'MODULEMAP_FILE' => '$(SRCROOT)/module', 'HEADER_SEARCH_PATHS' => '$(SDKROOT)/usr/include/libxml2 $(PODS_ROOT)/module $(SDKROOT)/usr/include/libresolv',
'LIBRARY_SEARCH_PATHS' => '"$(PODS_ROOT)/XMPPFramework/Vendor/libidn"', 'OTHER_LDFLAGS' => '"-lxml2"', 'CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES' => 'YES', 'ENABLE_BITCODE' => 'NO',  'SWIFT_INCLUDE_PATHS' => '$(SRCROOT)/module/module.modulemap'}

But pod spec lint will fail, telling me that he doesn't know my custom module.


Solution

  • 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 }