Problem with building a cmake based package using custom way

I want to build integrate and build aktualizr on my device, but an error occurs.
The Makefile I write is as below:

include $(TOPDIR)/rules.mk

# Name, version and release number
# The name and version of your package are used to define the variable to point to the build directory of your package: $(PKG_BUILD_DIR)
PKG_NAME:=aktualizr
PKG_VERSION:=2020.10
PKG_RELEASE:=1

PKG_BUILD_DIR=${BUILD_DIR}/${PKG_NAME}-${PKG_VERSION}
PKG_SOURCE:=${PKG_VERSION}.tar.gz
PKG_SOURCE_URL:=https://github.com/advancedtelematic/aktualizr/archive/refs/tags/
PKG_HASH:=fb4f6431244e1ae7ca60acefa8e60c147f4a144b03179fc665549fe5eba2664a

include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/cmake.mk

define Package/${PKG_NAME}
		SECTION:=libs
		CATEGORY:=Libraries
		TITLE:=aktualizr
		DEPENDS:=+asn1c +libboost_log +libboost_log_setup +libboost_program_options +libpsl +libcurl +libsodium +ostree
endef

define Package/${PKG_NAME}/description
		This is a FOTA client for embedded systems. It can be used to update the software on a device over-the-air.
endef

CMAKE_OPTIONS += -DCMAKE_BUILD_TYPE=Debug

define Build/Prepare
		$(Build/Prepare/Default)
		cd ${PKG_BUILD_DIR}/third_party && rm -rf googletest && git clone https://github.com/google/googletest.git
		rm -rf jsoncpp && git clone https://github.com/open-source-parsers/jsoncpp.git

endef

define Package/${PKG_NAME}/install
		$(INSTALL_DIR) $(1)/usr/bin
endef

$(eval $(call BuildPackage,${PKG_NAME}))

Steps to build aktualizr:

mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Debug ..

But the error tells me that I am building aktualizr in the source tree, how can I change to build it in the build directory.

Try setting CMAKE_BINARY_SUBDIR:=build in your OpenWrt Makefile

Thanks, Jow, This works for me!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.