Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Remove static lib dependencies when the user project for a CocoaPods is an static lib project itself
# we don't want to link static libs or it will fail to build
# see https://github.com/CocoaPods/CocoaPods/issues/117
targets = [:target1, :target2]
lib_dependencies = ['z']
post_install do |installer|
installer.libraries.select { |i| targets.include? i.target_definition.name.to_sym }.each do |l|
config_file_path = l.library.xcconfig_path
config_file_contents = File.read(config_file_path)
lib_dependencies.each { |dep| config_file_contents.gsub!(/ -l#{dep}/, '') }
File.open(config_file_path, 'w') { |file| file.write config_file_contents }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment