Tutorial by Examples

Head over to CMake download page and get a binary for your operating system, e.g. Windows, Linux, or Mac OS X. On Windows double click the binary to install. On Linux run the binary from a terminal. On Linux, you can also install the packages from the distribution's package manager. On Ubuntu 16.0...
CMake knows several build types, which usually influence default compiler and linker parameters (such as debugging information being created) or alternative code paths. By default, CMake is able to handle the following build types: Debug: Usually a classic debug build including debugging informa...
Given a C++ source file main.cpp defining a main() function, an accompanying CMakeLists.txt file (with the following content) will instruct CMake to generate the appropriate build instructions for the current system and default C++ compiler. main.cpp (C++ Hello World Example) #include <iostream...
First we can specify the directories of header files by include_directories(), then we need to specify the corresponding source files of the target executable by add_executable(), and be sure there's exactly one main() function in the source files. Following is a simple example, all the files are a...
This example shows how to deploy the "Hello World" program as a library and how to link it with other targets. Say we have the same set of source/header files as in the http://www.riptutorial.com/cmake/example/22391/-hello-world--with-multiple-source-files example. Instead of building fro...

Page 1 of 1