1

I need to set the Xcode architecture via CMake but can't seem to. I've Googled everywhere, checked the CMake docs and have also had a look at this thread: How to set up CMake to build an app for the iPhone

Here's what the relevant bit of my Xcode project looks like: enter image description here

Problem 1) Don't know why Xcode says 'SDK not found' even though that file exists.

Problem 2) Can't seem to set the 'Supported Platforms' value to 'iOS' via CMake.

Fixing one of the problems above by manually changing the setting in Xcode, seems to fix the other problem but I don't know how to achieve this via CMake.

Extract from my current CMakeLists.txt file:

SET (SDKPATH “/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk”
SET (CMAKE_OSX_SYSROOT "${SDKPATH}")
SET (CMAKE_XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET 6.0)
SET (CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphoneos")

Xcode version: 6.3.1, CMake version: 2.8.12.1

Community
  • 1
  • 1
Ash
  • 2,021
  • 2
  • 26
  • 59
  • Okay so I replaced the above bit in my CMakeLists.txt file with `SET (CMAKE_OSX_SYSROOT iphoneos)` and that seems to fix Problem 2...and a consequence, the Base SDK in Xcode gets set to 'Latest iOS'. I was under the impression that `CMAKE_OSX_SYSROOT` is meant to point to the path to an actual sdk. At least, that's what every single thread I've read everywhere seems to suggest. – Ash May 04 '15 at 06:57
  • A side note: Why don't you use the latest cmake? – Antonio May 04 '15 at 09:54

1 Answers1

1

With CMake 2.8.12, you need to place set(CMAKE_OSX_SYSROOT your_sdk_name) before project(your_project_name). For example:

CMakeLists.txt

set(CMAKE_OSX_SYSROOT iphonesimulator9.2)

cmake_minimum_required(VERSION 2.8)

project(test)
rvighne
  • 20,755
  • 11
  • 51
  • 73
L. Liu
  • 11
  • 2