[CMake] Specifying library build path for simulator and device for an iOS target in Xcode

David Cole david.cole at kitware.com
Fri Nov 11 11:22:49 EST 2011


On Fri, Nov 11, 2011 at 11:12 AM, Daniel Dekkers <d.dekkers at cthrough.nl> wrote:
> Hi,
>
> We are building a lib and an example app in Xcode (4.2) targeting iOS (5.0).
>
> The top-level CMakeLists.txt recurses into lib and example:
>
> PROJECT(Suite)
> ADD_SUBDIRECTORY(MyLibrary)
> ADD_SUBDIRECTORY(MyExample)
>
> The lib is built in the traditional way…
>
> PROJECT(MyLib)
>> ADD_LIBRARY( ${MYLIB_SOURCES} )
>
> As is the example:
>
> PROJECT(MyExample)
>> ADD_EXECUTABLE(MyExample MACOS_BUNDLE ${MYEXAMPLE_SOURCES})
> TARGET_LINK_LIBRARIES( MyExample MyLib)
> ADD_DEPENDENCIES(MyExample MyLib)
>
> But during linking of the example, MyExample expects the built lib to be in:
>
> path/to/build/MyLibrary/Debug/
>
> While Xcode will build to
>
> path/to/build/MyLibrary/Debug-iphonesimulator/
>
> or
>
> path/to/build/MyLibrary/Debug-iphoneos/
>
> depending on the scheme you select.
>
> Anyone know how to get "inbetween", letting CMake know there is this "-iphoneos" or "-iphonesimulator" postfix needed.
>
> Thanks,
> Daniel
>
>
>
>
> --
>
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>

Are you using CMake 2.8.6?

Is the following line in your top level CMakeLists.txt file?

  set(CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphoneos;-iphonesimulator")

If not, try both of those and let me know if it's still wrong. The
effective platform stuff is new in 2.8.6, and there are probably still
some rough edges for "complex" projects...


HTH,
David


More information about the CMake mailing list