Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create XCode workspace and pin a project from command line

Tags:

xcode

cmake

I found that it is possible to create XCode project from command line with a help of CMake (are there any other options?). Is there any tool to create XCode workspace and pin projects into it?

If not, can I create it manually? My current version of XCode (7.3 beta) makes a workspace that consists of below file structure:

WORKSPACE_NAME.xcworkspace/
  contents.xcworkspacedata
  xcuserdata/
    USER_NAME.xcuserdatad/
      UserInterfaceState.xcuserstate

Content of contents.xcworkspacedata looks straightforward and I guess this is the file that pins projects into workspace. UserInterfaceState.xcuserstate is a binary file that can be generated when workspace is opened in XCode.

Summing up, if there is no command line tool for creating workspace and pinning projects into it, can I just generate proper contents.xcworkspacedata file or should I do something more?

like image 227
mkk Avatar asked Apr 23 '26 17:04

mkk


1 Answers

If your project has a CMakeLists.txt file, CMake can generate an XCode project file from it (on the command line), and you can then build it as well (from the command line).

Assuming you are currently in your project's source directory and it contains a CMakeLists.txt:

$ mkdir build && cd build $ cmake -G "Xcode" ../ $ cmake --build .

Alternatively you can remove the -G option, it'll then generate a Makefile, and then you can do make and it will build on the command-line too, using the Xcode build tools.

like image 95
Ela782 Avatar answered Apr 26 '26 12:04

Ela782