Skip to content

Instantly share code, notes, and snippets.

@sixman9
Created December 14, 2010 10:42
Show Gist options
  • Save sixman9/740257 to your computer and use it in GitHub Desktop.
Save sixman9/740257 to your computer and use it in GitHub Desktop.
cmake files for Apple IOS development (has C++ lean, can be adapted however)
# See original post at http://stackoverflow.com/questions/822404/how-to-set-up-cmake-to-build-an-app-for-the-iphone
cmake_minimum_required(VERSION 2.8)
cmake_policy(SET CMP0015 NEW)
cmake_policy(SET CMP0016 NEW)
project(test)
set(NAME test)
file(GLOB headers *.h)
file(GLOB sources *.cpp)
SET (SDKVER "4.1")
SET (DEVROOT "/Developer/Platforms/iPhoneOS.platform/Developer")
SET (SDKROOT "${DEVROOT}/SDKs/iPhoneOS${SDKVER}.sdk")
SET (CMAKE_OSX_SYSROOT "${SDKROOT}")
SET (CMAKE_OSX_ARCHITECTURES "$(ARCHS_UNIVERSAL_IPHONE_OS)")
#Other 'CMAKE_OSX_ARCHITECTURES' iPhone/IOS option examples
#SET (CMAKE_OSX_ARCHITECTURES "armv6" "armv7")
#SET (CMAKE_OSX_ARCHITECTURES $(ARCHS_STANDARD_32_BIT))
set(CMAKE_CXX_FLAGS "-x objective-c++")
set(CMAKE_EXE_LINKER_FLAGS
"-framework AudioToolbox -framework CoreGraphics -framework QuartzCore -framework UIKit"
)
link_directories(\${HOME}/\${SDKROOT}/lib)
set(MACOSX_BUNDLE_GUI_IDENTIFIER "com.mycompany.\${PRODUCT_NAME:identifier}")
set(APP_TYPE MACOSX_BUNDLE)
add_executable(${NAME}
${APP_TYPE}
${headers}
${sources}
)
target_link_libraries(${NAME}
# other libraries to link
)
# code signing
set_target_properties(${NAME} PROPERTIES XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "iPhone Developer: My Name")
@newNcy
Copy link

newNcy commented Aug 16, 2021

do you know how to link an existing framework?
你知道怎么链接一个已经存在的framework吗

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment