Commit cfce5e9e authored by Samuel E. Giddins's avatar Samuel E. Giddins

[XCConfig] Only include -ObjC flag when linking against a static lib

parent 6e69aff6
......@@ -49,8 +49,10 @@ module Pod
# @return [Xcodeproj::Config]
#
def generate
includes_static_libs = !target.requires_frameworks?
includes_static_libs ||= target.pod_targets.flat_map(&:file_accessors).any? { |fa| !fa.vendored_libraries.empty? }
config = {
'OTHER_LDFLAGS' => '$(inherited) ' + XCConfigHelper.default_ld_flags(target),
'OTHER_LDFLAGS' => '$(inherited) ' + XCConfigHelper.default_ld_flags(target, includes_static_libs),
'PODS_ROOT' => target.relative_pods_root,
'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) COCOAPODS=1',
}
......
......@@ -31,8 +31,9 @@ module Pod
# while `-fobjc-arc` is included only if requested in the
# Podfile.
#
def self.default_ld_flags(target)
ld_flags = '-ObjC'
def self.default_ld_flags(target, includes_static_libraries = false)
ld_flags = ''
ld_flags << '-ObjC' if includes_static_libraries
if target.podfile.set_arc_compatibility_flag? &&
target.spec_consumers.any?(&:requires_arc?)
ld_flags << ' -fobjc-arc'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment