Skip to content

Instantly share code, notes, and snippets.

@rickyah
Created May 18, 2014 19:06
Show Gist options
  • Save rickyah/d946e416ad979aef87d3 to your computer and use it in GitHub Desktop.
Save rickyah/d946e416ad979aef87d3 to your computer and use it in GitHub Desktop.
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