Jump to content
  • Advertisement
Sign in to follow this  
Krankles

Cmake or Make for C++ Projects?

This topic is 2076 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, just a quick question, but I was looking at automating my compiling process and have been using make (with a makefile) to do so. However, I saw cmake and was wondering whether it is easier to learn and/or is more organized? If someone had experience with the 2, what would you recommend?

 

Thanks.

Share this post


Link to post
Share on other sites
Advertisement

CMake isn't a build tool in itself, it's a meta-build tool.

You can use a CMake file to generate a makefile for you, which you then use to build your project, or you can use the CMake file to make a project for an IDE like Microsoft Visual Studio, etc...

 

I use it so that I don't have to manually manage my Visual Studio project files, and so that when I port to linux I can also generate makefiles.

Share this post


Link to post
Share on other sites

CMake or Premake4 would be my suggestions. I find Premake is a little nicer to work with. But CMake has better support for library location auto-discovery. They both can generate makefiles or Visual Studio projects,(or xcode and codeblocks iirc). The benifits of choosing one of these project generator tools is that they automate some of the process of binding libraries and whatnot in order to avoid some of the platform dependent changes you'd need to run on windows/linux.  Both also really narrow down the scope of what it takes to describe your project, where raw makefiles can get rather verbose rather quickly.

Share this post


Link to post
Share on other sites

Oh, sorry for my misunderstanding! I thought they were the same :S

 

Anyways, thanks for the help! I'll definitely try out CMake and get the Makefiles automated then. :)

Share this post


Link to post
Share on other sites

I need some help learning CMake, I've read the documentation and the tutorial that they've officially gave out to use, but it's all very confusing. Is there any good alternatives to it?

 

Thanks.

Share this post


Link to post
Share on other sites
CMake is not exactly perfect but I do not know of any better alternative (although I have not tried out Premake4 so far). I do not see any reasonable way to manage a single project across multiple building platforms without something like it (for example one project I work for needs to be buildable across MSVC, Linux gcc, Android and iOS).

That said, like any other tool, CMake largely requires a lot of practical experience. Try to create a project which just contains a single "hello world" source file. That should be doable in 5 or 10 lines if memory serves. Then slowly work yourself up using the documentation and tutorials to include management of external libraries, project-internal libraries with varying dependencies and custom build steps.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!