From charlesreid1

No edit summary
No edit summary
Line 42: Line 42:


While these can be customized, they are cryptic and can take a long time to try and figure out.  Due to these esoteric "find rules", it can be difficult to get CMake to "pick up" on custom installs of third-party packages like Boost.  This isn't the case with all third-party packages, just the ones for which "find rules" exist.
While these can be customized, they are cryptic and can take a long time to try and figure out.  Due to these esoteric "find rules", it can be difficult to get CMake to "pick up" on custom installs of third-party packages like Boost.  This isn't the case with all third-party packages, just the ones for which "find rules" exist.
Incidentally, many consider this an "advantage".  Whatever.


= Presentations =
= Presentations =

Revision as of 01:36, 6 April 2011

Cmake is a build system for C++ projects. It is an alternative to GNU autotools.

Installing

Downloading

You can either visit http://www.cmake.org and download the binary, or you can use wget:

$ wget http://www.cmake.org/files/v2.8/cmake-X.Y.Z.tar.gz

and untar it using tar:

$ tar xvzf cmake-X.Y.Z.tar.gz

Configuring

Cmake is straightforward to install. It is intended to replace autotools, but it still uses autotools to build it - but a little differently.

You can configure it by running:

$ ./bootstrap --prefix=/path/to/cmake/build

Then you can type make and make install, and you're good to go. Don't forget to add /path/to/cmake/build/bin to your $PATH!

Advantages and Disadvantages

Advantages

Disadvantages

Finding Packages

Using the CMake function find_package() can cause many difficulties, because Cmake has an unusual way of dealing with software dependencies. Unlike GNU autotools, you can't always point CMake to a path where you built something and expect it to "just work". (Boost is an excellent example of this.)

CMake contains pre-existing "rules" for finding things that can make life difficult for people who specify --prefix when they install things. CMake contains a list of rules in /path/to/cmake/X.X/Modules/cmake-X.X/. These rules will be in files named Find(Package).cmake (e.g. FindBoost.cmake).

While these can be customized, they are cryptic and can take a long time to try and figure out. Due to these esoteric "find rules", it can be difficult to get CMake to "pick up" on custom installs of third-party packages like Boost. This isn't the case with all third-party packages, just the ones for which "find rules" exist.

Incidentally, many consider this an "advantage". Whatever.

Presentations

Professor James Sutherland's presentation on using CMake, part of the 2010 Scientific Computing Summer Workshop, is here: File:CMake Sutherland.pdf

This presentation contains an example of a "Hello World" program built with CMake.

References