Jump to content

  • Log In with Google      Sign In   
  • Create Account


Cmake or Make for C++ Projects?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
6 replies to this topic

#1 Krankles   Members   -  Reputation: 281

Like
0Likes
Like

Posted 16 January 2013 - 09:05 PM

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.



Sponsor:

#2 Hodgman   Moderators   -  Reputation: 28452

Like
3Likes
Like

Posted 16 January 2013 - 09:30 PM

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.



#3 KulSeran   Members   -  Reputation: 2223

Like
0Likes
Like

Posted 16 January 2013 - 09:32 PM

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.



#4 Krankles   Members   -  Reputation: 281

Like
0Likes
Like

Posted 16 January 2013 - 09:36 PM

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. :)



#5 Lightness1024   Members   -  Reputation: 702

Like
0Likes
Like

Posted 17 January 2013 - 10:01 AM

cmake is the good !



#6 Krankles   Members   -  Reputation: 281

Like
0Likes
Like

Posted 18 January 2013 - 06:32 AM

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.



#7 BitMaster   Crossbones+   -  Reputation: 3770

Like
0Likes
Like

Posted 18 January 2013 - 07:37 AM

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.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS