CMake
CMake is a unified, cross-platform, open-source build system that enables developers to build, test and package software by specifying build parameters in simple, portable text files. It works in a compiler-independent manner and the build process works in conjunction with native build environments, such as make, Apple's Xcode and Microsoft Visual Studio. It also has minimal dependencies, C++ only. CMake is open source software and is developed by Kitware.
CMake can:
- Create libraries
- Generate wrappers
- Compile source code
- Build executables in arbitrary combinations
CMake was developed beginning in 1999 to provide a powerful, cross-platform build environment for the Insight Segmentation and Registration Toolkit (ITK). The project is funded by the United States National Library of Medicine as part of the Visible Human Project. It was partially inspired by pcmaker, which was made by Ken Martin and other developers to support the Visualization Toolkit (VTK). At Kitware, Bill Hoffman blended components of pcmaker with his own ideas, striving to mimic the Unix configure tool’s functionality. CMake was first implemented in 2000 and further developed in 2001. Continued development and improvements were fueled by the incorporation of CMake into developers’ own systems, including:
- The VXL Project
- The CABLE; features added by Brad King
- GE Corporate R&D for support of DART
Additional features were created when VTK transitioned to CMake for its build environment and for supporting ParaView.
Features
CMake can handle in-place and out-of-place builds, enabling several builds from the same source tree and also supports cross-compilation. In addition, the ability to build a directory tree outside of the source tree is a key feature, ensuring that if a build directory is removed, the source file remains unaffected.
Another feature of CMake is the ability to generate a cache to be used with a graphical editor, which, when CMake is run, can locate executables, files and libraries. This information goes into the cache, that can then be tailored before generating the native build files..
Complicated directory hierarchies and applications that rely on several libraries are well supported by CMake. For instance, CMake is able to accommodate a project that has multiple toolkits, or libraries, that each have multiple directories. In addition, CMake can work with projects that require executables to be created before generating code to be compiled for the final application. Its open-source, extensible design allows CMake to be extended and adapted as necessary for specific projects.