Ash
Ash

Reputation: 2294

CMake Xcode specify platform

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

Upvotes: 1

Views: 3346

Answers (1)

L. Liu
L. Liu

Reputation: 11

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)

Upvotes: 1

Related Questions