8.29. CMake 4.3.2

Bootstrap and install CMake in the final target environment without requiring an existing target CMake.

Input assumption: cmake-4.3.2.tar.gz is already present in /sources from the chapter 4 source staging step.

Source URL: https://github.com/Kitware/CMake/releases/download/v4.3.2/cmake-4.3.2.tar.gz

Upstream build note: upstream documents the Unix source build as ./bootstrap, make, and make install. The bootstrap script creates a temporary CMake first, so this section does not require an existing target cmake.

License note: the CMake source tree is BSD-3-Clause. The tarball also contains bundled third-party code and license texts; this section disables the Qt GUI and uses the already installed system curl, zlib, liblzma, and libarchive libraries to avoid building the bundled copies of those components.

Licenses:

Dependencies:

CMake is a cross-platform build-system generator and project configuration tool. we need it to provide the final target cmake, ccmake, ctest, and cpack commands for packages that use CMake build definitions.

Extract and Enter the Source Tree

cd /sources
rm -rf cmake-4.3.2
tar -xf cmake-4.3.2.tar.gz
cd cmake-4.3.2

Bootstrap CMake

CC=/system/binaries/cc CXX=/system/binaries/c++ ./bootstrap \
    --prefix=/system \
    --bindir=binaries \
    --datadir=share/cmake-4.3 \
    --docdir=documentation/cmake \
    --mandir=documentation/man-pages \
    --parallel="$LWI_MAKE_JOBS" \
    --no-qt-gui \
    --no-system-libs \
    --system-curl \
    --system-zlib \
    --system-liblzma \
    --system-libarchive \
    --generator=Ninja \
    -- \
    -DCMAKE_BUILD_TYPE=Release \
    -DBUILD_TESTING=OFF

Build CMake

ninja $LWI_MAKE_FLAGS

Install CMake

ninja install

Verify CMake

cmake --version
ccmake --version
ctest --version
cpack --version
After this step is complete, you can remove the extracted source directory and source tarball from /sources if you do not plan to rebuild CMake again.

Command Explanations