My project uses CocoaPods and also custom xcconfig
files. Until now, this hasn't caused any problems: I've just had to #include
the CocoaPods-generated configuration at the end of my custom configuration.
However, I've run into a problem where a need to conditionally specify OTHER_LDFLAGS
based on the xcconfig
, but I can't figure out how to do this.
As a start, I've tried simply logging the OTHER_LDFLAGS
like this, but the flags aren't actually logged:
post_install do |installer_representation|
installer_representation.project.targets.each do |target|
target.build_configurations.each do |config|
name = target.name
puts "Target Found: #{name}"
flags = config.build_settings['OTHER_LDFLAGS']
puts "OTHER_LDFLAGS Found: #{flags}"
end
end
end
The output looks like this:
Target Found: Pods-ProjectName-DependencyName1
OTHER_LDFLAGS Found: # nothing here...?
Target Found: Pods-ProjectName-DependencyName2
OTHER_LDFLAGS Found: # again nothing...
# etc...
Target Found: Pods-ProjectName # Cool, this is the main target pod
OTHER_LDFLAGS Found: # ...
How can I actually modify OTHER_LDFLAGS
via the CocoaPods post-install hook?