Creating a binary
In this tutorial, we will learn how to create executables using the qibuild framework
Basic CMake ¶
Every CMake project should begin with something like:
cmake_minimum_required(VERSION 2.8) find_packagte(qibuild) project(foo)
The first line is required by the CMake standards.
The second line let you use the
The project() call is good practice, and is used by several IDEs.
Adding an executable ¶
To add an executable, simply call
. The first argument is the name
of the executable, followed by the sources of the executable.
The paths of the sources are relative to the path where the CMakeLists is found, so you should create the main.cpp right next to the CMakeLists
If you are on UNIX, the executable will end up in
If you are using Visual Studio, the executable will be in:
build/sdk/bin/foo_d.exe(if you chose to build in debug)
build/sdk/bin/foo.exe(if you chose to build in release)
To run directly the foo executable from Visual Studio, simply
right-click on the foo project and select
press F5 as usual.
If you try to run the
project which is selected by default, you will
get an error message because the
project does not correspond to any