Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Tutorials on Cmake
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
japtar10101
Tux's lil' helper
Tux's lil' helper


Joined: 12 Apr 2009
Posts: 103

PostPosted: Sat Jul 18, 2009 9:31 pm    Post subject: Tutorials on Cmake Reply with quote

I want to use cmake to develop my project. I only found examples on the internet, but I was wondering if there was a fleshed-out tutorial to at least get started on.

I also have only beginners knowledge of Makefiles. Do I need to learn this first before I start learning the CMakeLists.txt stuff? I've heard that the 2 have very similar syntax.
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 14731

PostPosted: Sat Jul 18, 2009 11:10 pm    Post subject: Reply with quote

On what platforms will your project be built? How complex will it be? Do you anticipate having one source file, 10, or 100? Will you be spreading the files over multiple directories or storing everything in one directory?

Depending on your choice of platform, you may be better off using autotools, or skipping the wrapper and writing a Makefile directly.
Back to top
View user's profile Send private message
japtar10101
Tux's lil' helper
Tux's lil' helper


Joined: 12 Apr 2009
Posts: 103

PostPosted: Sun Jul 19, 2009 12:01 am    Post subject: Reply with quote

Hu wrote:
On what platforms will your project be built? How complex will it be? Do you anticipate having one source file, 10, or 100? Will you be spreading the files over multiple directories or storing everything in one directory?

Depending on your choice of platform, you may be better off using autotools, or skipping the wrapper and writing a Makefile directly.
Good question.

I'm going to be working on a game project. Compatibility with Windows is preferred, though currently not necessary. My main issue is how to link dependent packages to go with my project, such as art files and, more importantly, installed game libraries.

I'm an organization-heavy person, so it won't be unusual for me to create 50 source files for one project. And of course, I will be spreading this about in many directories.

My beef with using make is that it's not well-integrated with the Windows environment. Sure, there's MingGW and Cygwin to take care of that, but I would strongly prefer being able to compile it natively anyways.

Of course, I could be wrong. Any suggestion on the subject will help.

I know nothing about autotools. :-P
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 14731

PostPosted: Sun Jul 19, 2009 4:08 am    Post subject: Reply with quote

If you plan to use a Microsoft C compiler, you would be better off using a tool that can generate build files to run the Microsoft compiler. If you will use MinGW gcc or Cygwin gcc, I see no reason not to use plain make for simplicity.

If you go with a Makefile, read Recursive Make Considered Harmful before beginning.
Back to top
View user's profile Send private message
165177
Apprentice
Apprentice


Joined: 27 Apr 2007
Posts: 156

PostPosted: Sun Jul 19, 2009 11:56 am    Post subject: Reply with quote

Hu wrote:
If you plan to use a Microsoft C compiler, you would be better off using a tool that can generate build files to run the Microsoft compiler.

CMake can do so.

Quote:
If you will use MinGW gcc or Cygwin gcc, I see no reason not to use plain make for simplicity.

Plain Makefiles are not simple, if dependencies and platform checks are involved. Compared to CMake, Makefiles aren't simple at all, not even for trivial tasks. CMake files are usually shorter, and much more readable, as CMake's scripting language provides built-in commands for common tasks like building executables and shared libraries.

@japtar10101:
CMake isn't similar to Makefiles, knowledge about the latter won't be very helpful when writing CMake files. The CMake Wiki has a section about Tutorials.
Back to top
View user's profile Send private message
japtar10101
Tux's lil' helper
Tux's lil' helper


Joined: 12 Apr 2009
Posts: 103

PostPosted: Sun Jul 19, 2009 4:18 pm    Post subject: Reply with quote

lunar wrote:
Hu wrote:
If you plan to use a Microsoft C compiler, you would be better off using a tool that can generate build files to run the Microsoft compiler.

CMake can do so.

Quote:
If you will use MinGW gcc or Cygwin gcc, I see no reason not to use plain make for simplicity.

Plain Makefiles are not simple, if dependencies and platform checks are involved. Compared to CMake, Makefiles aren't simple at all, not even for trivial tasks. CMake files are usually shorter, and much more readable, as CMake's scripting language provides built-in commands for common tasks like building executables and shared libraries.

@japtar10101:
CMake isn't similar to Makefiles, knowledge about the latter won't be very helpful when writing CMake files. The CMake Wiki has a section about Tutorials.

I'll look into that page, then. I'll get back when I need help again :).
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum