Working with the CMake build system
The GNU make system is a great tool when you build exclusively for Linux systems. However, some packages are multiplatform and need a way to manage Makefile
files on different operating systems. CMake is a cross-platform build system that can work not only with GNU make, but also Microsoft Visual Studio and Apple's Xcode.
Getting ready
The CMake tool parses CMakeLists.txt
files in every directory to control the build process. An example CMakeLists.txt
file, to compile the helloworld
example, follows:
cmake_minimum_required(VERSION 2.8.10) project(helloworld) add_executable(helloworld helloworld.c) install(TARGETS helloworld RUNTIME DESTINATION bin)
How to do it...
The Yocto build system also contains classes with the required knowledge to build CMake packages. All your recipe needs to do is inherit the cmake
class and configure the arguments to be passed to the configure
script in the EXTRA_OECMAKE
variable. Usually, the CMake system understands how to...