Installation and configuration of CMake in windows

This article provides two methods to install the CMake command, students who do not know whether their computer has a CMake command line can enter

cmake -version

Check.

If it appears as shown in the figure below, the CMake command has been installed in the computer. After installing the method in this article, you can also use this method to check whether CMake is successfully installed.

 If words such as cmake version do not appear, there is no CMake in the computer and you need to install it yourself.

1. Use pip to install directly

Prerequisites: python

pip is the package installer for Python. It is a command-line tool that allows you to install and manage Python packages, which are collections of Python modules that provide additional functionality to your Python programs.

This method is suitable for those who have already installed python 2.79 or python 3.4 in the computer, use win+R to open and run, enter cmd, open the command line, enter

pip install cmake

The cmake command can be automatically installed and configured.

2. Semi-automatic installation and configuration cmake command

First download the source code and installation package of cmake: Download | CMake

Prerequisites: Versions after VS 2008 or Codeblocks or Codelite or Kate or Sublime Text 2

 

Download Windows Source and Windows X64 Installer respectively, unzip the ZIP file and open README, which contains detailed official installation instructions, Running CMake | CMake .

(1) Click to open the msi file

(2) Select Next, select the installation location and select the automatic configuration environment variable (environment variable), and then continue to Next until Finish

(3) Open the bin folder, click the cmake-gui.exe file, select source code, place the location of the Windows Source folder downloaded above on the source code location, and create a new folder to place the compiled file.

Click the configure button first, after the compilation is complete, select the two items in red according to the figure below, and then click generate

 (4) The installation configuration is complete

3. chatgpt's suggestion for installing CMake

 

The code snippets above are:

@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"

choco install cmake

Guess you like

Origin blog.csdn.net/m0_64206188/article/details/128359182