<div dir="ltr">Thanks for the response.  I've moved to a more standard *nix layout for all platforms, and will rely on a post-build step to create my framework (for now).  If I find a fix, I'll be sure to share it here. <div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Apr 29, 2015 at 5:22 AM, Eric Wing <span dir="ltr"><<a href="mailto:ewmailing@gmail.com" target="_blank">ewmailing@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 4/25/15, David Hirvonen <<a href="mailto:dhirvonen@elucideye.com">dhirvonen@elucideye.com</a>> wrote:<br>
> I'm hitting a link error when linking an iOS application with an internally<br>
> created framework/library using the the CMake Xcode generator and an iOS<br>
> toolchain.  I've put together a minimal CMakeLists.txt example here:<br>
><br>
> <a href="https://github.com/headupinclouds/cmake_framework_test/" target="_blank">https://github.com/headupinclouds/cmake_framework_test/</a><br>
><br>
> The problem is described in detail in the the README, and reproduced here<br>
> in the email for completeness.<br>
><br>
> The repository is intended as a simple unit test to illustrate an apparent<br>
> link and build location mismatch when linking a framework to an iOS<br>
> application using the "standard" iOS toolchain<br>
</span>> <<a href="https://code.google.com/p/ios-cmake/" target="_blank">https://code.google.com/p/ios-cmake/</a>> (I realize this toolchain isn't<br>
<span class="">> provided with CMake). I've included the ios toolchain in this repository to<br>
> make it easy to reproduce the issue. I've include both the iOS application<br>
> that reproduces the link error, and an OS X application, which links to the<br>
> library in correct framework location. I'm looking for a CMakeLists.txt fix<br>
> or possible workaround. There are two top level convenience bash scripts<br>
> for building the applications with cmake using an xcode generator.  The<br>
> CMake version is 3.2.1.<br>
><br>
> cmake --version<br>
> cmake version 3.2.1<br>
><br>
</span>> <<a href="https://github.com/headupinclouds/cmake_framework_test/blob/master/README.md#ios-framework-and-application-error" target="_blank">https://github.com/headupinclouds/cmake_framework_test/blob/master/README.md#ios-framework-and-application-error</a>>iOS<br>
<div><div class="h5">> framework and application error:<br>
><br>
> bash -fx ./test-ios.sh<br>
> + NAME=_builds/ios<br>
> + cmake -GXcode -H. -B_builds/ios -DCMAKE_TOOLCHAIN_FILE=iOS.cmake<br>
><br>
> <snip><br>
> clang: error: no such file or directory:<br>
> '/Users/dhirvonen/devel/cmake_framework_test/_builds/ios/Debug-iphoneos/TF.framework/Versions/A/TF'<br>
> ** BUILD FAILED **<br>
> The following build commands failed:<br>
>     Ld _builds/ios/Debug-iphoneos/testa.app/testa normal armv7<br>
> (1 failure)<br>
> library path:  _builds/ios/Debug-iphoneos/TF.framework/TF<br>
><br>
> This produces a flat framework layout (ignoring the FRAMEWORK_VERSION<br>
> property (which is fine with me if I can get it to work)). It looks like<br>
> this:<br>
><br>
> tree _builds/ios/Debug-iphoneos/TF.framework<br>
> _builds/ios/Debug-iphoneos/TF.framework<br>
> ├── Info.plist<br>
> ├── TF<br>
> └── _CodeSignature<br>
>     └── CodeResources<br>
><br>
> But when it reaches the link command for the ios application:<br>
><br>
> target_link_libraries(testa TF)<br>
><br>
> it fails, since it seems to expect the library to be two directories down<br>
> within a versioned framework layout:<br>
><br>
> TF.framework/Versions/A/TF<br>
><br>
> instead the directory is here:<br>
><br>
> TF.framework/TF<br>
><br>
> I'm looking for a solution to either:<br>
><br>
</div></div>>    - correct the TF link path to use the actual (non versioned) framework<br>
<span class="">>    layout that is currently generated, or<br>
</span>>    - correct the framework so that it uses the versioned layout to make<br>
<span class="">>    that consistent with the link path<br>
><br>
</span>> <<a href="https://github.com/headupinclouds/cmake_framework_test/blob/master/README.md#os-x-framework-and-application-success" target="_blank">https://github.com/headupinclouds/cmake_framework_test/blob/master/README.md#os-x-framework-and-application-success</a>>OS<br>
<div><div class="h5">> X framework and application success:<br>
><br>
> When I build this for OS X it seems to work fine.<br>
><br>
> bash -fx ./test-osx.sh<br>
> + NAME=_builds/osx<br>
> + cmake -GXcode -H. -B_builds/osx<br>
> <snip><br>
> ** BUILD SUCCEEDED **<br>
> library path: _builds/osx/Debug/TF.framework/Versions/A/TF<br>
><br>
> This produces a framework with the following layout:<br>
><br>
> tree _builds/osx/Debug/<br>
> _builds/osx/Debug/<br>
> ├── TF.framework<br>
> │   ├── Resources -> Versions/Current/Resources<br>
> │   ├── TF -> Versions/Current/TF<br>
> │   └── Versions<br>
> │       ├── A<br>
> │       │   ├── Resources<br>
> │       │   │   └── Info.plist<br>
> │       │   ├── TF<br>
> │       │   └── _CodeSignature<br>
> │       │       └── CodeResources<br>
> │       └── Current -> A<br>
> └── testb<br>
><br>
> and the call to<br>
><br>
> target_link_libraries(testb TF)<br>
><br>
> picks up the TF library in the correct location.<br>
><br>
> I'm curious if there is a variable or property that needs to be set for the<br>
> iOS example to give the same framework layout.<br>
><br>
<br>
<br>
</div></div>I have not tried this (yet), but my guess is that CMake needs to be<br>
patched to understand iOS frameworks. iOS frameworks are new as of iOS<br>
8. 3rd parties were not allowed to make frameworks before that.<br>
Additionally, CMake's framework support was implemented for Mac like a<br>
decade ago. Because the iOS framework structure (and .app structure<br>
for another matter) is different, CMake will likely need to be taught<br>
how to make a proper structure for iOS.<br>
<br>
If you do any work on this, I am interested in your results.<br>
Eventually, I would like to support iOS frameworks, though I'm<br>
probably at least 6 months from that since I need iOS 7 to drop off<br>
the face of the earth, which means after iOS 9 is released.<br>
<br>
(Note to non-iOS developers reading this: iOS does not allow flat<br>
.dylib files for shared libraries. You must build a framework.)<br>
<span class="HOEnZb"><font color="#888888"><br>
-Eric<br>
--<br>
Beginning iPhone Games Development<br>
<a href="http://playcontrol.net/iphonegamebook/" target="_blank">http://playcontrol.net/iphonegamebook/</a><br>
</font></span></blockquote></div><br></div>