Skip to content

Compile CMake on CentOS 7

Tested on version 3.28.20231017

Requires

Before compiling cmake, you need to compile openssl and GCC (for glibc dependencies).

Get cmake source

find latest source here

then

sh
cd ./<SOURCE_DIR>
./bootstrap --prefix=<SOURCE_DIR>/build 
make

This will not work, because i have tried many things but i don't know how to link cmake with openssl library, but i found a workaround.

Workaround

Open the file ./<SOURCE_DIR>/CMakeCache.txt and edit following lines:

cmake
// Path to a library.
OPENSSL_CRYPTO_LIBRARY:FILEPATH=<OPENSSL_DIR>/build/lib/libcrypto.so

// Path to a file.
OPENSSL_INCLUDE_DIR:PATH=<OPENSSL_DIR>/build/include

// Path to a library.
OPENSSL_SSL_LIBRARY:FILEPATH=<OPENSSL_DIR>/build/lib/libssl.so

Then run

sh
make clean
./bootstrap --prefix=<SOURCE_DIR>/build
make
make install

Then you can find cmake in <SOURCE_DIR>/build/bin/cmake and you can use it directly, put theses binaries in a rez package, etc.