create Xcodeproject with CMake

Discussion and help for Compilation problems and platform portability.

Moderator: coordinators

create Xcodeproject with CMake

Postby salwa » Thu Nov 18, 2010 8:32 am

Hello I'm new here, I need help with CMakeLists. I have created an empty project with cmake (I do not know if it was applied correctly). Now I would like to add this some files to these project, but does not work. (I know this error message, but I do not know how the solvent with cmake) also how can I assign to the compiler cmake to xcode?
Here is (an attempt) cmakelists and error.
Code: Select all
cmake_minimum_required (VERSION 2.8)
project (iPadtest)

set(src
   RootViewController.xib
   RootViewController.h
   RootViewController.m
)

add_executable(iPadtest ${src})

# Michael Aaron Safyan (michaelsafyan@gmail.com). Copyright (C) 2009-2010. Simplified BSD License.
SET (CMAKE_SYSTEM_NAME Generic)
SET (CMAKE_SYSTEM_VERSION 1)
SET (CMAKE_SYSTEM_PROCESSOR i686)
SET_PROPERTY(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS TRUE)

SET (SDKVER "3.2")
SET (DEVROOT "/Developer/Platforms/iPhoneSimulator.platform/Developer")#
SET (SDKROOT "${DEVROOT}/SDKs/iPhoneSimulator${SDKVER}.sdk")
SET (CMAKE_OSX_SYSROOT "${SDKROOT}")
SET (CMAKE_OSX_ARCHITECTURES "i386" "x86_64")

SET (CMAKE_C_COMPILER "${DEVROOT}/usr/bin/gcc-4.2")
SET (CMAKE_CXX_COMPILER "${DEVROOT}/usr/bin/g++-4.2")

SET (CMAKE_C_COMPILER "${DEVROOT}/usr/bin/gcc-4.2")
SET (CMAKE_CXX_COMPILER "${DEVROOT}/usr/bin/g++-4.2")

SET (CMAKE_C_FLAGS "-std=c99" "-x objective-c")
SET (CMAKE_C_FLAGS_DEBUG ${CMAKE_C_FLAGS} "-DDEBUG=1" "-ggdb")
SET (CMAKE_C_FLAGS_RELEASE ${CMAKE_C_FLAGS} "-DNDEBUG=1")
SET (CMAKE_C_FLAGS_RELWITHDEBINFO ${CMAKE_C_FLAGS} "-DNDEBUG=1" "-ggdb")

SET (CMAKE_CXX_FLAGS "-x objective-c++")
SET (CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS} "-DDEBUG=1" "-ggdb")
SET (CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS} "-DNDEBUG=1")
SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO ${CMAKE_CXX_FLAGS} "-DNDEBUG=1" "-ggdb")

ADD_DEFINITIONS("-arch i386")
ADD_DEFINITIONS("-arch x86_64")
ADD_DEFINITIONS("-pipe")
ADD_DEFINITIONS("-no-cpp-precomp")
ADD_DEFINITIONS("--sysroot=${SDKROOT}")
ADD_DEFINITIONS("-miphoneos-version-min=${SDKVER}")

INCLUDE_DIRECTORIES(SYSTEM "${SDKROOT}/usr/include")
INCLUDE_DIRECTORIES(SYSTEM "${SDKROOT}/opt/iphone-simulator-${SDKVER}/include")
INCLUDE_DIRECTORIES(SYSTEM "${SDKROOT}/usr/local/iphone-simulator-${SDKVER}/include")

LINK_DIRECTORIES("${SDKROOT}/usr/lib")
LINK_DIRECTORIES("${SDKROOT}/opt/iphone-simulator-${SDKVER}/lib")
LINK_DIRECTORIES("${SDKROOT}/usr/local/iphone-simulator-${SDKVER}/lib")

SET (CMAKE_FIND_ROOT_PATH "${SDKROOT}" "/opt/iphone-simulator-${SDKVER}/" "/usr/local/iphone-simulator-${SDKVER}/")
SET (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH)
SET (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

SET (iPhone 1)
SET (iPhoneSimulator 1)
SET (iPhoneSimulator_VERSION ${SDKVER})

Code: Select all
Check dependencies
target specifies product type 'com.apple.product-type.tool', but there's no such product type for the 'iphonesimulator' platform

how can i add Xcodefiles with cmaklists.txt, can you give me an example.
Please help. Thanks
salwa
 
Posts: 2
Joined: Thu Nov 18, 2010 8:05 am

Re: create Xcodeproject with CMake

Postby tomb » Thu Nov 18, 2010 8:34 am

Are you sure you're in the right forum? :) Looks ipad/iphone related to me...
User avatar
tomb
Developer
 
Posts: 1918
Joined: Thu Oct 11, 2007 4:23 pm
Location: Oslo, Norway

Re: create Xcodeproject with CMake

Postby salwa » Wed Nov 24, 2010 3:09 am

tomb wrote:Are you sure you're in the right forum? :) Looks ipad/iphone related to me...


i'm not sure but Looks viewtopic.php?f=22&t=116
Thanks ;)
salwa
 
Posts: 2
Joined: Thu Nov 18, 2010 8:05 am

Re: create Xcodeproject with CMake

Postby tomb » Wed Nov 24, 2010 3:15 am

Hi,

Thats a specific tutorial for building Luxrender on Mac - if you're looking for a general tutorial on how to use xcode+cmake then I think you may be better off in a general mac developers forum :)

Tom
User avatar
tomb
Developer
 
Posts: 1918
Joined: Thu Oct 11, 2007 4:23 pm
Location: Oslo, Norway


Return to Compilation & Portability

Who is online

Users browsing this forum: No registered users and 1 guest