How to use CMake

Source: Internet
Author: User
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:

  1. $> Ccmake Directory
  2. $> CMake Directory
  3. $> 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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.