Klaas
Klaas

Reputation: 22773

How to use 'SQLite' (the wrapper on github) in a Command Line Tool?

I'm successfully using the great Swift wrapper for sqlite from https://github.com/stephencelis/SQLite.swift in a Cocoa application.

But when I try to use the wrapper in a Command Line Tool project and follow the same detailed installation steps I get the following error:

Check dependencies

Unable to run command 'PBXCp SQLite.framework' - this target might include its own product.

I checked the dependencies, but couldn't figure out how to solve this.

Upvotes: 1

Views: 504

Answers (1)

radex
radex

Reputation: 6566

You can't link dynamic framework (a .framework) with your app in a Command Line Tool project. The reason is simple — a command line tool target builds a single binary file. This is unlike a regular Cocoa application, where the .app "file" is actually a folder containing .frameworks and other stuff inside.

So basically you'd have to build a static library instead (one that links with your app's binary during compilation) — except that as of Xcode 6.1 it's not possible yet with Swift.

So the only thing you can do — AFAIK — is add the SQLite.swift's source code directly into your own app target (so it compiles together). It's ugly, but works.

Upvotes: 1

Related Questions