i.MX 8 getting started: cmake package
We already started to use cmake instead of writing Makefile by our own in buildroot. Let’s see how to have a cmake package in Yocto.
Add your source file and CMakeLists
Here we use a simple cpp source file to test c++11 and pthread.
Then prepare your CMakeLists.txt:
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
Notice : install should be added into your CMakeLists.txt if you want your binary to be installed into rootfs.
Write your recipe
SUMMARY = "cmake example"
There is no need to override do_install nor do_config in this scenario. cmake.bbclass has already defined those tasks and we can just inherit from it.
If pkgconfig is required by your cmake, use inherit pkgconfig cmake instead.
Then add your packages into your layer, don’t forget config your package as IMAGE_INSTALL_append in layer.conf. After that, you should have a folder tree like this:
Build your package!
$ bitbake cmakeexample
Build your image
Of course don’t forget to re-build your image.
$ bitbake fsl-image-qt5-validation-imx