How to convert a framework target to a static library target?
How to convert a framework target to a static library target?
- Subject: How to convert a framework target to a static library target?
- From: Jens Alfke <email@hidden>
- Date: Fri, 15 Jan 2016 17:04:21 -0800
I need to make some modifications to my Xcode project, and for once I’m stumped. In a nutshell I need to either:
(a) Duplicate an existing Mac framework target and change it into a static library;
(b) or create a new static library target and copy the (very large) list of source files from the existing target.
I can’t manage to do either of these in Xcode 7.2.
(Why am I doing this? The project builds a Mac framework that links against the system SQLite dylib. Now we need to produce an alternate version of it that contains a locally-built variant of SQLite called SQLCipher — that is, it needs to link a static libSQLCipher.a instead of a dynamic libSQLite.dylib.
The sane way to do this is to create a target that builds our source code as a static library. Then both of the framework targets will have no source code, but will make that library a dependency and link with its .a file. The _wrong_ way to do this is to duplicate the existing framework target and change the SQLite library to SQLCipher; this will create duplicates of a ton of build settings and cause lots of trouble whenever we need to add source files or change any settings. DRY!
The problem is how to create this new target that has all the existing 127 source files and compiler settings, but produces a static library…)
The problems I’m running into:
(a) After duplicating the target I can find no way to make it stop being a framework target. No matter what build settings I change — particularly changing Mach-O Type to Static Library — its icon remains the little toolbox and it insists on producing a .framework directory. I’ve done a line-by-line comparison with a target from another project that builds a static library, and I can’t find the magic setting that controls this. I now suspect it’s not accessible in the UI.
(b) If instead I use the New Target assistant to create a static library target, I can’t copy the list of source files from the other target. (There are 127 source files, and those are not all the source files in the project, so there’s no reasonable way to do it by hand.) I can select the Compile Sources list from the old target and Copy, but when I go to the new target I can’t Paste. And if I open both targets at once in two editor panes, Xcode refuses to let me drag the source files from one to the other — it terminates the drag as soon as it enters the other pane.
I’m almost tempted to open the pbxproj file in a text editor and start copying and pasting, but I suspect the scope of the change is too large to do without intimate knowledge of the file format.
(And yes, I should file enhancement requests for these, but I need to make these changes RIGHT NOW for a looming deadline and I can’t afford the time today…)
—Jens
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden