But first let's add a CMakeLists.txt file and write something meaningful in it. To make things more interesting, later on I will spice up the project with an external dependency and some parameters to pass at build stage to perform conditional compilation. A toy project to work withįor this introduction I will be using a dummy C++ project made up of few source files: myApp/ This prevents cluttering up the source directory and makes it easy to start over again: just remove the build directory and you are done. Any file required for the final build, executables included, will be stored in a separated build directory (usually called build/). This is done by the so-called generators, CMake components responsible for creating the build system files.Īnother nice CMake feature is the so-called out-of-source build. CMake will read the instructions in it and will produce the desired output. This special text file describes how the project is structured, the list of source files to compile, what CMake should generate out of it and so on. That's what the word meta stands for: CMake builds build systems.Ī project based on CMake always contains the CMakeLists.txt file. For example, CMake on Windows will produce a solution for Visual Studio CMake on Linux will produce a Makefile CMake on macOS will produce a project for XCode and so on. It doesn't actually build your source code: instead, it generates native project files for the target platform. What is CMake exactlyĬMake is known as a meta build system. Rather, just a practical, ongoing introduction to the tool for humble enthusiasts like me. Mind you, this won't be the definitive CMake bible. In the following paragraphs we will understand what CMake is exactly, its underlying philosophy and how to use it to build a demo application from scratch. In recent years it has become a de-facto standard for C and C++ applications, so the time has come for a lightweight introductory article on the subject. This simple program is provided in tutorial-viewer.CMake is a collection of open-source and cross-platform tools used to build and distribute software. Let's start to write our first program to see how to read an image and open a window to display the image. Note also that all the material (source code and images) described in this tutorial is available in ViSP source code, in tutorial/image folder. If you are not familiar with CMake, you can check the tutorial. The easiest way of using ViSP in your project is to use CMake. In this tutorial you will learn how to use ViSP either on Unix-like systems (including OSX, Fedora, Ubuntu, Debian. Tutorial: Installation from prebuilt packages on Linux Ubuntu.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |