ccgus/fmdb — pull request #179 by snooc (2013-10-18 18:57:07+00:00)
Title: Compilation Issue when using CocoaPods + SQLCipher 

When using the FMDB and the SQLCipher pods, FMDB is not compiled with the `-DSQLITE_HAS_CODEC` c-flag.

This causes the `setKey` method to always return `NO` since `SQLITE_HAS_CODEC` is not set.

I was able to fix this by adding a post_install hook to my Podfile. I'm sure that this could easily be moved into a post_install hook in the podspec.

I'd be willing to submit a pull request adding it to the podspec or making a wiki page to document the fix.

Here is the hook. Cocoapod hooks are not very pretty.

```ruby
# Podfile
platform :ios, '6.0'

pod 'SQLCipher'
pod 'FMDB'

target :ProjectTests, exclusive: true do
pod 'Kiwi'
end

post_install do |lib_rep|
lib_rep.project.targets.each do |target|
if target.name == 'Pods-FMDB'
target.build_configurations.each do |config|
if config.build_settings['OTHER_CFLAGS'].nil?
config.build_settings['OTHER_CFLAGS'] = Array.new
end
puts "Added -DSQLITE_HAS_CODEC CFlag to #{target.name} - #{config.name}"
config.build_settings['OTHER_CFLAGS'].unshift('-DSQLITE_HAS_CODEC')
end
end
end
end
```

Output:

```
$ pod install
Analyzing dependencies
Downloading dependencies
Using FMDB (2.1)
Using Kiwi (2.2.1)
Using SQLCipher (2.1.1)
Generating Pods project
Added -DSQLITE_HAS_CODEC CFlag to Pods-FMDB - Release
Added -DSQLITE_HAS_CODEC CFlag to Pods-FMDB - Debug
Integrating client project
```

The hook prepends the c-flag to the Debug and Release builds for the Pods-FMDB target.