Windows compile and install CMake

CMake is used to compile software platform-independent, recently required CMake, but due to network reasons to CMake official website is impossible downloaded elsewhere ... such as Gitee does fit, but not compiled, only the source code, searched the whole network only in Linux compiler tutorial, not of Windows. Here I will look at how to record compiled on Windows CMake

A. Download Source

First, the above Gitee download the source code package
Gitee warehouse
do not go at GitHub, too slow, with who knows who
extract to your specified location after the download is good, as shown below (decompression is very slow, I do not demonstrate a it ...)
Unpacked directory
after you create a file called in this directory buildempty folder, used to store compiled files
Added build /

II. Get .sln file

Here, I assume you have installed in the computer Visual Studiothe
first thing you need to have a low version of CMake. . . . . . .
Here Insert Picture Description
Here Insert Picture Description
So I'll just give a lower version of it . Extraction code: 0tyx
remember Added environment variable
to open the command line in the previous step to establish a buildfolder, as shown in FIG
Here Insert Picture Description
enter the command cmake ..
and then will begin to output code, like this child, I find this is another project to simulate the actual situation almost
Here Insert Picture Description
is complete, open the buildfolder, you can see this file structure, or analog, the actual situation of a lot more than the picture
Here Insert Picture Description
we can see to get a sln file, this is it

Three. Visual Studio compiler

Click to get the sln file into the Visual Studio, click the Batch Build, select the following few Here Insert Picture DescriptionHere Insert Picture Description
do not forget I still get a simulated demonstration project in Oh, the reality may be different. The selected four is mandatory, and the other that you need, then click Generate to begin the long process of generation ...

IV. Completed generation, remove the document

Reserved build directory in the following two folders, delete the rest Here Insert Picture Description
then this is the software you want to move them to the location you want, you can join an environment variable

V. Testing

Enter the cmake -versioncommand to check the software version
Here Insert Picture Description
can be seen in 3.17.2
to compile a hello world try
Here Insert Picture Description

VI. I wish you success

Released six original articles · won praise 3 · Views 327

Guess you like

Origin blog.csdn.net/weixin_44587168/article/details/104650767