Ubuntu upgrade cmake version

        We need to use cmake when learning slam and other content, but the default cmake level may not be enough. For example, the Ubuntu16.04 I use has cmake3.5 installed by default, and when installing libraries such as Sophus, you need at least version 3.10.

        After combining the attempts of several articles, I finally came up with a feasible update method.

        Note: Do not uninstall and then install, as the original link will be lost.

Table of contents

cmake update

1.cmake download

2. Unzip

3.Configuration

 4.Compile

5.Installation

6.Soft link

 7. Verify version


cmake update

        To query the version, you can open a terminal and enter:

cmake --version

        In addition, if there is an error in the intermediate make and other steps, for example, it shows that openssl is missing, just find the tutorial and install it.

1.cmake download

        Open the terminal and enter the command to download the compressed package:

wget https://cmake.org/files/v3.22/cmake-3.22.1.tar.gz

        You can also download it from the official website. This is version 3.22.1.

2. Unzip

        If you extract it to the current folder, enter in the terminal:

tar -xvzf cmake-3.22.1.tar.gz

        The actual cmake folder is in the /usr/share/ directory. You can also unzip it directly to this directory, which is more organized. However, all subsequent commands in this folder require sudo permissions:

sudo tar -xvzf cmake-3.22.1.tar.gz -C /usr/share

3.Configuration

        All subsequent operations are divided into two types: decompressing by default and placing it in the /usr/share/ directory. Most of the differences are based on whether sudo is added or not.

        First go to the target folder:

cd cmake-3.22.1

        If placed in the /usr/share/ directory:

cd /usr/share/cmake-3.22.1

        Then configure:

chmod 777 ./configure
./configure

        If placed in the /usr/share/ directory:

sudo chmod 777 ./configure
sudo ./configure

        Both results are: Cmake has bootstrapped. Now run make.

 4.Compile

        enter

make

        If placed in the /usr/share/ directory:

sudo make

        The result is:

5.Installation

        Same as this one:

sudo make install

       The result is:

 

6.Soft link

        enter:

sudo update-alternatives --install /usr/bin/cmake cmake /usr/local/bin/cmake 1 --force

        The result is:

 7. Verify version

        enter:

cmake --version

        The result is:

Guess you like

Origin blog.csdn.net/weixin_43907136/article/details/127569449