# Example how to make a recipe that uses CMake for building
# Please note that this is a recipe to build the package. For package to be added to an Image, another recipe needs to be changed.
# Example: This package is added to be part of coreos-image-full-cmdline image.
# A new line: IMAGE_INSTALL += "cmake-demo" is added to layers/meta-belden-coreos/recipes-core/images/coreos-image-full-cmdline.bb

DESCRIPTION = "Simple helloworld cmake application"

# Recipe must include a licence
LICENSE = "CLOSED"

# Revision of this recipe (optional)
PR = "r1"

# Systemd file
SYSTEMD_SERVICE_${PN} = "hello.service"

# Recipe needs to know where the needed files are
SRC_URI += "file://CMakeLists.txt\
		file://lib/CMakeLists.txt \
		file://src/CMakeLists.txt \
		file://src/helloworld.c \
		file://src/hello.service \
		file://lib/lib-demo.c \
		file://lib/lib-demo.h"

# List of files and directories that are placed in a package
FILES:${PN} += "${systemd_unitdir}/system/hello.service"

# Temporary work directory for each recipe where extracted source files are kept
S="${WORKDIR}"

# CMake will do most of the work, so it needs to be inherited
inherit cmake systemd

# Passing any needed configure options to CMake
EXTRA_OECMAKE = ""

# Systemd service is being installed using this function (this is an example). Other files are installed using CMake
do_install:append() {
  install -d ${D}/${systemd_unitdir}/system
  install -m 0644 ${WORKDIR}/src/hello.service ${D}/${systemd_unitdir}/system
}


