Skip to content
Jason Charney edited this page Jan 30, 2015 · 3 revisions

CMake is cross-platform free and open-source software for managing the build process of software using a compiler-independent method. It is designed to support directory hierarchies and applications that depend on multiple libraries. It is used in conjunction with native build environments such as make, Apple's Xcode, and Microsoft Visual Studio. It has minimal dependencies, requiring only a C++ compiler on its own build system.

Installation

CMake will require the following software

cd ~/Software
curl -SL http://www.cmake.org/files/v3.1/cmake-3.1.1.tar.gz | tar xzv
cd cmake-3.1.1/
./configure && make && sudo make install && sudo ldconfig
..

Building with CMake instead of Make

Building software with CMake kinda has a different set of instructions that building software with Make.

Make is pretty much your standard software for building software, and the instructions of using it generally look like this.

./configure && make && sudo make install && sudo ldconfig

What happens here

  • ./configure run a script that executes configuration. Some software projects don't have this.
  • 'makewhich is the command that tells the software to look for a __makefile__ in the current diretory and use it to build software. This file contains a list ofgccand/org++` commands for the most part. A makefile allows for the person who downloads the software to automate this process rather than compile each file individually, much like a shell script.
  • sudo make install is often the third and final step of the ./configure && make && sudo make install trio. It executes the install command that may be in the make file to move the software that we built into some place like /usr/local. Because that directory is outside of the home directory, root access is required, hence the sudo command.
  • sudo ldconfig isn't really required, per-se, but I just add it so the ld.so.conf file checks and updates any libraries and headers it may encounter.

TODO: Do I really need to do that forth step?

CMake projects are constructed a bit differently. Generally you have to creat the build/ directory, go to it, and then run a cmake command to execute the makefile in the parent directory like so.

mkdir build && cd build
cmake .. && make && sudo make install && sudo ldconfig

Basically, cmake replaces the need to create a configure script by making one.

See Also

External Links

Clone this wiki locally