Using static libraries in Xcode 4
- First create the library project.
- For each header file make sure it is set as public in the “Target Membership” section of the inspector pane.
- Set the following settings in build settings.
- Installation directory => $(BUILT_PRODUCTS_DIR)
- Skip Install => Yes
- Public Headers Folder Path => $(TARGET_NAME)
- Now create a new workspace for your project.
- Add the static library to your project.
- Add build target dependencies. Select apps build target and add the static library to the “Link binary with libraries” build phase.
- Add the static libraries headers. Open “Build Settings” tab and locate “User Header Search Paths”. Set to $(BUILT_PRODUCTS_DIR)
- Configure the projects scheme. Edit your project scheme and add the static library build target before our apps build target.
- Last include in the project precompiled header the library main headers (This step is optional)
20110718.7