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

Daniel Dekkers d.dekkers at cthrough.nl
Fri Nov 11 11:12:43 EST 2011


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






More information about the CMake mailing list