How to create Xcode project from already existing

2020-06-09 04:11发布

问题:

I am new to OSx, can someone help to create Xcode project from existing code? I want to try some features of Xcode like 'profile'.

I currently use Clion for my cmake project, it is also in git repo. I simply want to import it from Xcode but it's not that easy I guess. Here some info about project and IDE:

  • It is just a console app written in C++ and cmake project
  • It is also on git repo
  • Xcode Version 8.0 (8A218a)
  • OS El Capitan 10.11.6

If you need more info, I can give more. Thanks for help.

回答1:

Cmake has a generator for XCode. Try:

cmake -G Xcode <dir of CMakeLists.txt>


回答2:

What I do:

"File"->"New"->"Project..."

Select command line tool:

Fill in some stuff if you'd like:

Run the dummy project:

Click on the project file and "Add files to" your project:

Browse to your pile of source. Expand the options. I tend use "added folders" as "Create Groups":

Go through and prune out the files you don't want:

Build. Likely you'll need to keep removing files or adding them till your project works.