2

I'm writing a plain C project. I'm using a Mac and I like working with Xcode and I want to use the Xcode project and build environment. I'd like to be able to build it on other platforms though. Not being overly familiar with Linux (yet) I assume this would involve a makefile. My project has no dependencies and it's about as vanilla as it gets.

Is there an easy way to do this? Will I have to keep track of two separate build scripts / configurations?

2
  • This looks more like a question about working with Linux, as you seem happy with Xcode, and your title may mean this question is missed by the people best placed to answer it Commented Dec 15, 2009 at 13:33
  • Fair point, thanks. I've changed the title. Commented Dec 15, 2009 at 14:05

1 Answer 1

3

It is possible to make Xcode use external build scripts but in your case that shouldn't be necessary. Xcode projects that do not have external dependencies build out of the box. You won't need to do anything for that to work. In order for your project to also build on other platforms a simple makefile should suffice. When you build on Mac OS X you let Xcode do the work and when you build on another platform you let the makefile and make utility do the work.

Once you start building more complex projects you may want to learn how to use a cross-platform build system. Two popular build systems are GNU autotools and Cmake. GNU autotools is very complex, made up of many different utilities and has a steep learning curve, but there is plenty of documentation available for it online. CMake is a single tool, easy to learn, but online documentation is sparse, to take full advantage of it one has to get a copy of the CMake book. CMake has the advantage that it can generate Xcode projects automatically, it can also generate projects for Microsoft's IDE on Windows. GNU autotools cannot do that.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.