Introduction to CMake

The CMake package contains a modern toolset used for generating Makefiles. It is a successor of the auto-generated configure script and aims to be platform- and compiler-independent. A significant user of CMake is KDE since version 4.



Development versions of BLFS may not build or run some packages properly if LFS or dependencies have been updated since the most recent stable versions of the books.

Package Information

  • Download (HTTP):

  • Download MD5 sum: 0f11cf15c7f2fa6234b9fc415c78029c

  • Download size: 10.4 MB

  • Estimated disk space required: 503 MB (add 1.2 GB for tests)

  • Estimated build time: 2.7 SBU (add 3.9 SBU for tests, both using parallelism=4)

CMake Dependencies



GCC-13.2.0 (for gfortran), git-2.42.0 (for use during tests), Mercurial-6.5.2 (for use during tests), (Qt-5.15.11 or qt-alternate-5.15.11) (for the Qt-based GUI), sphinx-7.2.6 (for building documents), Subversion-1.14.2 (for testing), cppdap, jsoncpp, and rhash

Installation of CMake

Install CMake by running the following commands:

sed -i '/"lib64"/s/64//' Modules/GNUInstallDirs.cmake &&

./bootstrap --prefix=/usr        \
            --system-libs        \
            --mandir=/share/man  \
            --no-system-jsoncpp  \
            --no-system-cppdap   \
            --no-system-librhash \
            --docdir=/share/doc/cmake-3.27.7 &&

To test the results, issue: LC_ALL=en_US.UTF-8 bin/ctest -j<N> -O cmake-3.27.7-test.log, where <N> is an integer between 1 and the number of system cores. Setting LC_ALL is needed to prevent some test failures when some of the locale variables are set to non English locales.

If you want to investigate a problem with a given "problem1-test", use bin/ctest -R "problem1-test" and, to omit it, use bin/ctest -E "problem1-test". These options can be used together: bin/ctest -R "problem1-test" -E "problem2-test". Option -N can be used to display all available tests, and you can run bin/ctest for a sub-set of tests by using separated by spaces names or numbers as options. Option --help can be used to show all options.

Now, as the root user:

make install

Command Explanations

sed ... Modules/GNUInstallDirs.cmake: This command disables applications using cmake from attempting to install files in /usr/lib64/.

--system-libs: This switch forces the build system to link against Zlib, Bzip2, cURL, nghttp2, Expat and libarchive installed on the system.

--no-system-jsoncpp and --no-system-cppdap: These switches remove the JSON-C++ library from the list of system libraries. A bundled version of that library is used instead.

--no-system-librhash: This switch removes the librhash library from the list of system libraries used. A bundled version of that library is used instead.

--no-system-{curl,libarchive,libuv,nghttp2}: Use the corresponding option in the list for the bootstrap if one of the recommended dependencies is not installed. A bundled version of the dependency will be used instead.

--qt-gui: This switch enables building the Qt-based GUI for CMake.

--parallel=: This switch enables performing the CMake bootstrap with multiple jobs at one time.


Installed Programs: ccmake, cmake, cmake-gui (optional), cpack, and ctest
Installed Libraries: None
Installed Directories: /usr/share/cmake-3.27 and /usr/share/doc/cmake-3.27.7

Short Descriptions


is a curses based interactive frontend to cmake


is the makefile generator


(optional) is the Qt-based frontend to cmake


is the CMake packaging program


is a testing utility for cmake-generated build trees