Can't use as a dependency within another cocoapod project.
I'd love to build a project, mine is named Liquid, that uses ObjectiveRocks however if you add the library you can't compile the pod.
s.dependency 'ObjectiveRocks'
The compiler can't seem to find certain headers:

@mbalex99 Hey there, the headers in question are not available in the iOS target, because it only contains the RocksDB Lite version.
You could try to add these to the Preprocessor Macros of your project.
ROCKSDB_LITE=1 NROCKSDB_THREAD_STATUS=1
You also could add this to your Podfile:
post_install do |installer_representation|
installer_representation.pods_project.targets.each do |target|
if target.name == "Pods-ObjectiveRocks"
target.build_configurations.each do |config|
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)', 'ROCKSDB_LITE =1', 'NROCKSDB_THREAD_STATUS=1']
end
end
end
end
Let me know if this helps. If not, I would investigate this further 😉
Haven't tried this directly in a project, just typed it down here.
Thanks so much!!
Hmm that's what I've been trying:
Here's a dummy project that shows what I'm doing: https://github.com/mbalex99/rocksdb-liquid
You can open Examples/Liquid.xcworkspace and if you build it you will get an Error
In the podspec You can see that I'm doing this:
s.dependency 'ObjectiveRocks'
shared_ios_xcconfig = { 'GCC_PREPROCESSOR_DEFINITIONS' => 'ROCKSDB_LITE=1 IOS_CROSS_COMPILE=1 NROCKSDB_THREAD_STATUS=1' }
s.ios.pod_target_xcconfig = shared_ios_xcconfig
s.ios.user_target_xcconfig = shared_ios_xcconfig
I'll give it a go now. I'll let you know when I find anything 👍
Ah this is what I had to do
- add this to the podspec
s.dependency 'ObjectiveRocks'
s.ios.pod_target_xcconfig = { 'GCC_PREPROCESSOR_DEFINITIONS' => 'ROCKSDB_LITE=1 IOS_CROSS_COMPILE=1 NROCKSDB_THREAD_STATUS=1' }
- And in the YourCocoapodProject_Tests target go to Build Settings and go to Preprocessor Macros_ and add
ROCKSDB_LITE=1 IOS_CROSS_COMPILE=1 NROCKSDB_THREAD_STATUS=1to both Debug and Release
🤔 I wonder what we can do not have to add this so people can build rich experience on top of ObjectiveRocks
Yes, that's what I meant with the macros. And you're right, it is not ideal to have to add these manually to the project.
The most strait-forward way to tackle this would be to provide a separate pod for each platform, which I'm not really fond of 😞
I'll browse the Cocoapods docs, maybe I'll find something there.
I see! I can't seem to find too much on Cocoapods repo about how do do this effectively.
Same here, no luck in the docs.
It seem that the pos_install hook is the only Cocoapods way to achieve this.
@mbalex99 It's strange that you'd need to add those since they're already defined in the podspec itself: https://github.com/iabudiab/ObjectiveRocks/blob/develop/ObjectiveRocks.podspec#L126 These get pulled in during a normal pod install
Might be worth asking this on StackOverflow.com or https://github.com/CocoaPods/Core
@rob-keepsafe The problem is the test target. It seems that CocoaPods does not add those definitions to it.
I had same issue with test project, just added it to test project as dependency and issue goes away.