CMake Introduction
CMake is a cross-platform installation (compilation) tool that can be used to describe the installation of all platforms (the compilation process) with simple statements. He is able to output a variety of Makefile or project files that can test the C + + features supported by the compiler, similar to the Automake under UNIX.
CMake How to use
All of the CMake statements are written in a file called: CMakeLists.txt. When the CMakeLists.txt file is determined, the associated variable value can be configured with the Ccmake command. This command must point to the directory where the CMakeLists.txt is located. After the configuration is complete, apply the CMake command to generate the appropriate makefile (under the UNIX like system) or the project file (specified with the appropriate programming tools under window).
Its basic operating procedures are:
- $> Ccmake Directory
- $> CMake Directory
- $> make
Where directory is the directory where CMakeList.txt resides;
- The first statement is used to configure the compilation options, such as the Vtk_dir directory, the general step does not need to configure, directly execute the second statement, but when there is an error, it is necessary to consider the configuration, this step is really useful;
- The second command is used to generate makefile files based on CMakeLists.txt;
- The third command is used to execute the makefile file, compile the program, and generate the executable file;
CMake implementation is so simple, the difficulty lies in how to write CMakeLists.txt files, the following example of a simple introduction to CMakeLists.txt writing, see the following CMakeLists.txt
How to use CMake