3

I've to automatize the creation of a Simple View Application, so the creation of a Xcode Project of it.

This will have to be a blank App. The base of a simple app, the first in the wizard of Xcode.

Googling and searching on Stackoverflow, seems that the best option to my goal is the use of Cmake. Unfortunatelly the documentation of this tool, imho, is so poor.

The best answer that i've found is this. But the result, with some differences, is not working. Another source that i've used is this.

My CMakeLists.txt is the following:

cmake_minimum_required (VERSION 3.7)

project(tempProject)
set(NAME tempProject)
set(DEPLOYMENT_TARGET 10.1)
set(CODESIGNIDENTITY "iPhone Developer: XXX")
set(DEVELOPMENT_TEAM_ID "team id")

set(CMAKE_OSX_SYSROOT iphoneos10.3)
set(CMAKE_OSX_ARCHITECTURES $(ARCHS_STANDARD))
set(CMAKE_CXX_FLAGS "-x objective-c++")

set(APP_TYPE MACOSX_BUNDLE)
set(PRODUCT_NAME ${NAME})
set(EXECUTABLE_NAME ${NAME})
set(MACOSX_BUNDLE_EXECUTABLE_NAME ${NAME})
set(MACOSX_BUNDLE_INFO_STRING "bundle")
set(MACOSX_BUNDLE_GUI_IDENTIFIER "bundle")
set(MACOSX_BUNDLE_BUNDLE_NAME "bundle")
set(MACOSX_BUNDLE_ICON_FILE "")
set(MACOSX_BUNDLE_LONG_VERSION_STRING "1.0")
set(MACOSX_BUNDLE_SHORT_VERSION_STRING "1.0")
set(MACOSX_BUNDLE_BUNDLE_VERSION "1.0")
set(MACOSX_BUNDLE_COPYRIGHT "Copyright YOU")
set(MACOSX_DEPLOYMENT_TARGET ${DEPLOYMENT_TARGET})

set(APP_HEADER_FILES
./AppDelegate.h
./ViewController.h
)

set(APP_SOURCE_FILES
./AppDelegate.m
./ViewController.m
)

set(RESOURCES
./Main.storyboard
./LaunchScreen.storyboard
)

add_executable(
${NAME}
${APP_TYPE}
${APP_HEADER_FILES}
${APP_SOURCE_FILES}
${RESOURCES}
)

find_library(UIKIT UIKit)
find_library(FOUNDATION Foundation)
find_library(MOBILECORESERVICES MobileCoreServices)
find_library(CFNETWORK CFNetwork)
find_library(SYSTEMCONFIGURATION SystemConfiguration)

set_target_properties(${NAME} PROPERTIES
    XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT "dwarf-with-dsym"
    RESOURCE "${RESOURCES}"
    XCODE_ATTRIBUTE_GCC_PRECOMPILE_PREFIX_HEADER "YES"
    XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET ${DEPLOYMENT_TARGET}
    XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY ${CODESIGNIDENTITY}
    XCODE_ATTRIBUTE_DEVELOPMENT_TEAM ${DEVELOPMENT_TEAM_ID}
    XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY "1"
    XCODE_ATTRIBUTE_CLANG_ENABLE_OBJC_ARC YES
    XCODE_ATTRIBUTE_COMBINE_HIDPI_IMAGES "NO")

The major problems for me are:

  • the structure of the dirs is different from an Xcode project generated via wizard;

  • the automated signing of the project is disabled;

  • if i try to run the App i've the following error: clang: error: linker command failed with exit code 1 (use -v to see invocation)

P.S. If you know another way to my goal, you're welcome.

Community
  • 1
  • 1
strano
  • 171
  • 12

0 Answers0