Skip to content

Conversation

@andrewcl
Copy link

Xcode 9 creates a warning error when attempting to build FMDB.
image

This warning is referenced by Issue #591.
Updating the import statement in FMDatabase resolves the warning.

@R4N
Copy link
Contributor

R4N commented May 17, 2018

@andrewcl

While this would work well for cocoapods, I think it would break things for any FMDB/SQLCipher direct integrations. A workaround currently is to use a post_install hook in the Podfile to add SQLCipher to the HEADER_SEARCH_PATHS of FMDB (so that it can find the proper SQLCipher copy of sqlite3.h).

post_install do |installer|
        installer.pods_project.targets.each do |target|
            if target.name == "FMDB"
               target.build_configurations.each do |config|
                   header_search = {"HEADER_SEARCH_PATHS" => "SQLCipher"}
                   config.build_settings.merge!(header_search)
               end
            end
        end
    end

I'm curious if adjusting the podspec for the SQLCipher subspec could accomplish the same thing?

i.e.

Add this to the subspec (adjusting FMDB's header search path within the SQLCipher subspec block):

ss.xcconfig = { 'HEADER_SEARCH_PATHS' => 'SQLCipher' }

So the SQLCipher subspec would look like:

 # use SQLCipher and enable -DSQLITE_HAS_CODEC flag
  s.subspec 'SQLCipher' do |ss|
    ss.dependency 'SQLCipher'
    ss.source_files = 'src/fmdb/FM*.{h,m}'
    ss.exclude_files = 'src/fmdb.m'
    ss.xcconfig = { 'OTHER_CFLAGS' => '$(inherited) -DSQLITE_HAS_CODEC -DHAVE_USLEEP=1' , 'HEADER_SEARCH_PATHS' => 'SQLCipher'}
  end

I've issued a PR to add this in.

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

Successfully merging this pull request may close these issues.

2 participants