Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pods.xcconfig HEADER_SEARCH_PATHS field does not include $(inherited) #1761

Closed
laptobbe opened this issue Jan 21, 2014 · 8 comments
Closed
Assignees

Comments

@laptobbe
Copy link

When integrating into a project that already uses other xcconfig files to change the HEADER_SEARCH_PATHS the pods overrides them even if the pods.xcconfig file is #included from the correct existing xcconfig file. The default behavior should be to always include $(inherited) as with #546

@alloy
Copy link
Member

alloy commented Jan 21, 2014

$(inherited) does not work when including xcconfig files, it only works when setting the settings on a ‘higher’ level. (The ‘project level’ as mentioned in the linked to ticket.)

So while I agree that we should probably do this for all settings, it won’t fix your case if you are including xcconfig files into other xcconfig files.

/cc @irrationalfab

@fabiopelosin
Copy link
Member

@alloy 👍

@laptobbe
Copy link
Author

We might be talking about two different things, I will explain my entire problem.

After running pod install I reverted what xcconfig file should be used for my project to the one I used before pod install, since cocoapods changed it to Pods.xcconfig. Then I included Pods.xcconfig from my own custom xcconfig. But to get it to compile I had to add $(inherited) to the HEADER_SEARCH_PATHS in the Pods.xcconfig file. If I do that everything works. However every time I run pod install this change is overridden and I have to manually change it again. If however the generator for the Pods.xcconfig included $(inherited) in the HEADER_SEARCH_PATHS everything would work right out of the box.

If we want to make this change I can work on a pull request.

@rivera-ernesto
Copy link
Contributor

Other related issues: #833 (from #523), #1705, #1736.

@tychop
Copy link

tychop commented Feb 5, 2014

This is my fix until cocoapods fixes the issue:
I use post install hook in my Podfile to rewite the Pods.xcconfig file:

post_install do |installer_representation|
    workDir = Dir.pwd
    xcconfigFilename = "#{workDir}/Pods/Pods.xcconfig"
    xcconfig = File.read(xcconfigFilename)
    newXcconfig = xcconfig.gsub(/HEADER_SEARCH_PATHS = "/, "HEADER_SEARCH_PATHS = $(inherited) \"")
    File.open(xcconfigFilename, "w") { |file| file << newXcconfig }
end

So after running pod install, the header search paths still contain the $(inherited) directive.

@rivera-ernesto
Copy link
Contributor

For this particular case a CocoaPods patch would be easy.

@vinzenzweber
Copy link

UPDATE:

Instead of adding the $(inherited) variable it is probably a better approach to add a PODS_ prefix to the Xcode variables in the Pods.xcconfig using the Podfile post_install approach.

Here is my setup of xcconfig files:

screen shot 2014-03-25 at 09 40 48

You could then include the Pods.xcconfig in your own e.g. Release.xcconfig and add the PODS_ variables to your own search paths.

platform :ios, '6.0'

pod 'AFNetworking', '~> 1.3.3'
pod 'ActionSheetPicker', '~> 0.0.2'
pod 'uservoice-iphone-sdk', '~> 3.0'
pod 'TestFlightSDK', '~> 3.0'
pod 'OpenUDID', '~> 1.0'
pod 'GoogleAnalytics-iOS-SDK', '~> 3.0'
pod 'DDPageControl', '~> 0.1'
pod 'RTLabel', '~> 1.0'
pod 'MCSegmentedControl', '~> 0.0'
pod 'SSKeychain', '~> 1.2'
pod 'SVProgressHUD', '~> 1.0'
pod 'SSZipArchive', '~> 0.3'
pod 'TTTAttributedLabel', '~> 1.8'
pod 'BugSense', '~> 3.6'

post_install do |installer_representation|
    workDir = Dir.pwd
    xcconfigFilename = "#{workDir}/Pods/Pods.xcconfig"
    xcconfig = File.read(xcconfigFilename)
    newXcconfig = xcconfig.gsub(/FRAMEWORK_SEARCH_PATHS/, "PODS_FRAMEWORK_SEARCH_PATHS")
    newXcconfig = newXcconfig.gsub(/HEADER_SEARCH_PATHS/, "PODS_HEADER_SEARCH_PATHS")
    newXcconfig = newXcconfig.gsub(/LIBRARY_SEARCH_PATHS/, "PODS_LIBRARY_SEARCH_PATHS")
    newXcconfig = newXcconfig.gsub(/OTHER_LDFLAGS/, "PODS_OTHER_LDFLAGS")
    newXcconfig = newXcconfig.gsub(/OTHER_CFLAGS/, "PODS_OTHER_CFLAGS")
    File.open(xcconfigFilename, "w") { |file| file << newXcconfig }
end

And here is my Shared.xcconfig which includes the PODS_ variables

#include "../Pods/Pods.xcconfig"

OTHER_LDFLAGS = $(inherited) ${PODS_OTHER_LDFLAGS} -all_load -lstdc++ -ObjC -lz -lxml2 -framework AdSupport -framework CoreTelephony -framework AVFoundation -framework CoreText -framework MobileCoreServices -framework Security -framework CFNetwork -framework CoreMedia -framework MediaPlayer -framework MessageUI -framework QuartzCore -framework StoreKit -framework EventKit -framework AudioToolbox -framework SystemConfiguration -framework Twitter -framework UIKit -framework Foundation -framework CoreGraphics -framework CoreData -framework ExternalAccessory -framework CoreBluetooth -framework WFConnector
FRAMEWORK_SEARCH_PATHS = $(inherited) ${PODS_FRAMEWORK_SEARCH_PATHS} "$(SOURCE_ROOT)/../vendor/Echo"
HEADER_SEARCH_PATHS = $(inherited)  ${PODS_HEADER_SEARCH_PATHS} "$(BUILT_PRODUCTS_DIR)/../../Headers" "$(SOURCE_ROOT)/../RestKit/Build/Headers" "$(SOURCE_ROOT)/../vendor/ios-openssl/include"
LIBRARY_SEARCH_PATHS = $(inherited) ${PODS_LIBRARY_SEARCH_PATHS} "$(SRCROOT)/../vendor/ios-openssl/lib"/**

@CocoaPodsBot
Copy link

Closed for duplicating #833 by @neonichu

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants