xcode - How to set up CMake to build a library for the iPhone -


By manually setting up some attributes, trying to use CMake to generate an Xcode configuration for the iPhone (I do not even have a way to go about this) My CMake file looks:

  Project (MYLIB) set (LIBRARY_OUTPUT_PATH $ {PROJECT_BINARY_DIR} / lib) Set (CMAKE_CONFIGURATION_TYPES Debug Release Debug - IPhone) Set (files list of my files ...) add_library (mylib FILES) set (XCODE_ATTRIBUTE_SDKROOT iphoneos2.2.1) # More features after First of all, it does not seem to work - in the generated Xcode project (I'm running  cmake . -G Xcode ),  SDKROOT  is still set to nothing, and so it says "current Mac OS". 

Secondly, assuming this is the right way to do this, how do I configure debug-iphone ?

As far as I can tell, there are two ways that most likely you are almost there To set XCode SDKROOT, use CMAKE_OSX_SYSROOT there is also the variable CMAKE_OSX_ARCHITECTURES , which is a map for ARCHS in XCode.

Use alternative. I have not used it for iphone but I have done this for other ARM processors You need to install a toolchain file that will look something like this:

  set ( Set CMAKE_SYSTEM_NAME generic set (CMAKE_SYSTEM_VERSION 1) set (CMAKE_SYSTEM_PROCESSOR hand-elf) (CMAKE_C_COMPILER / path / to / set (never CMAKE_FIND_ROOT_PATH_MODE_PROGRAM) set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE only)  

And then when you set (arc / bin / arm-alf-gcc) (CMAKE_FIND_ROOT_PATH / path / p Set / compiler) Set the Run Sentimental, set the CMAKE_TOOLCHAIN_FILE variable on the name of your toolchain file. Or if you only compile it for an architecture, you can work harder in the CMakeLists.txt file But I think that you will need to cross the compilation for the iPhone simulator and for the actual iPhone, right? So if you have to run one of these, maybe having a pair of building variants:

< Pre> cmake -DCMAKE_TOOLCHAIN_FILE = / path / to / my / iPhone-sim.cmake. Cmake -DCMAKE_TOOLCHAIN_FILE = / path / to / my / iphone-real.cmake.

Where to define the environment for sim / real files simulator or actual iphone compiler tools.

Some other links can help and


Comments