Existing Xcode Projects

This logic is referred as the “existing Xcode project” feature. This pull request supersedes https://github.com/CocoaPods/CocoaPods/pull/1497. Sister pull: https://github.com/CocoaPods/Core/pull/158.

--

##### Living TODO

- [ ] Find a non invasive mechanism to set the header search paths of the target of the existing Xcode project.
  - Approach a: shared build directory.
  - Approach b: see if the setting is inherited from the project to the sub-projects.
- [ ] Check how this approach blends with the pods per config stuff.
- [ ] Cleanup and final refinements.
- [ ] Adopt changes in Xcodeproj to add sub-projects.
- [ ] Decide what to do about different spec/subspecs referencing the same project (i.e. if to create two file references).
- [ ] Decide if a Pod target makes sense (to wrap the vendored target) or wether the vendors target should be linked directly.
- [ ] Tests.
- [ ] Change approach to fixtures: (especially the `spec/fixtures/XcodeprojTest/XcodeprojTest.xcodeproj/project.pbxproj` which is being modified by the specs)
- [ ] Changelog.

--

##### Living Documentation

- Any Xcode project should only build its own code.
- The library’s instructions should instruct the user what the library’s dependencies are.
- The user must then also build those dependencies.
- All dependencies get added together at the last step in the build chain; user target linking.
- Frameworks do have pre-linking, so they need the `-undefined dynamic_lookup` lookup `OTHER_LDFLAG`.
- Static libraries have no linking at all, that’s left to the end target. So all `OTHER_LDFLAGS` go in the user’s app target.

--

Credit to:

- @diederich for submitting the issue.
- @pereckerdal for his terrific work!
- @alloy & @neonichu for the help in the identification of the best solution.

Notes:

- For the sake of the discussion this pull is pointing to the `lookback-pods-by-config` branch (which is expected to be merged in master soon).
- Previous comments in this issue have been cleaned up