Building a cmake application as a package , the configuartion section writes the build files to the src directory

I am trying to compile my package for openwrt 23.05

when I use the following Makefile it would go into the configuration section and then configure the project but writes the build files in the source directory instead of the package build dir, hence even replace the makefile with the Cmake generated makefile contents.

#
# Copyright (C) 2006 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
#
# Copyright (C) 2008 Frank Cervenka
#
# This is free software, licensed under the GNU General Public License v2.
#
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/cmake.mk

PKG_NAME:=mypackage
PKG_VERSION:=1.1.0.0
PKG_RELEASE:=11
PKG_BUILD_DIR:=$(BUILD_DIR)/mypackage-$(PKG_VERSION)
SOURCE_DIR:=/home/dost/Documents/openwrt/package/mypackage/src

define Package/mypackage
	SECTION:=Examples
	CATEGORY:=Examples
	TITLE:=Examplesn
	DEPENDS:=+libstdcpp +libjson-c 
endef

define Build/Configure
	IN_OPENWRT=1 \
	AR="$(TOOLCHAIN_DIR)/bin/$(TARGET_CROSS)ar" \
	AS="$(TOOLCHAIN_DIR)/bin/$(TARGET_CC) -c $(TARGET_CFLAGS)" \
	LD="$(TOOLCHAIN_DIR)/bin/$(TARGET_CROSS)ld" \
	NM="$(TOOLCHAIN_DIR)/bin/$(TARGET_CROSS)nm" \
	CC="$(TOOLCHAIN_DIR)/bin/$(TARGET_CC)" \
	GCC="$(TOOLCHAIN_DIR)/bin/$(TARGET_CC)" \
	CXX="$(TOOLCHAIN_DIR)/bin/$(TARGET_CROSS)g++" \
	RANLIB="$(TOOLCHAIN_DIR)/bin/$(TARGET_CROSS)ranlib" \
	STRIP="$(TOOLCHAIN_DIR)/bin/$(TARGET_CROSS)strip" \
	OBJCOPY="$(TOOLCHAIN_DIR)/bin/$(TARGET_CROSS)objcopy" \
	OBJDUMP="$(TOOLCHAIN_DIR)/bin/$(TARGET_CROSS)objdump" \
	TARGET_CPPFLAGS="$(TARGET_CPPFLAGS)" \
	TARGET_CFLAGS="$(TARGET_CFLAGS)" \
	TARGET_LDFLAGS="$(TARGET_LDFLAGS)" \
	cmake $(PKG_BUILD_DIR)/CMakeLists.txt
endef

define Package/mypackage/install
	$(INSTALL_DIR) $(1)/usr/bin
	$(INSTALL_BIN) $(PKG_BUILD_DIR)/cmaketest $(1)/usr/bin/
endef

$(eval $(call BuildPackage,mypackage))

here is the error

IN_OPENWRT=1 TARGET_CFLAGS="-Os -pipe -fno-caller-saves -fno-plt -fhonour-copts -mfloat-abi=hard -fmacro-prefix-map=/home/dost/Documents/openwrt/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/= -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro" TARGET_LDFLAGS="-L/home/dost/Documents/openwrt/staging_dir/toolchain-arm_cortex-a7+neon-vfpv4_gcc-13.2.0_musl_eabi/usr/lib -L/home/dost/Documents/openwrt/staging_dir/toolchain-arm_cortex-a7+neon-vfpv4_gcc-13.2.0_musl_eabi/lib -fuse-ld=bfd -znow -zrelro" cmake /home/dost/Documents/openwrt/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/mypackage-1.1.0.0/CMakeLists.txt
-- Building for OpenWrt
-- TARGET_LDFLAGS: -L/home/dost/Documents/openwrt/staging_dir/toolchain-arm_cortex-a7+neon-vfpv4_gcc-13.2.0_musl_eabi/usr/lib -L/home/dost/Documents/openwrt/staging_dir/toolchain-arm_cortex-a7+neon-vfpv4_gcc-13.2.0_musl_eabi/lib -fuse-ld=bfd -znow -zrelro
-- TARGET_CFLAGS: -Os -pipe -fno-caller-saves -fno-plt -fhonour-copts -mfloat-abi=hard -fmacro-prefix-map=/home/dost/Documents/openwrt/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/= -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro
-- Configuring done (0.0s)
-- Generating done (0.0s)
-- Build files have been written to: /home/dost/Documents/openwrt/package/mypackage
touch /home/dost/Documents/openwrt/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/mypackage-1.1.0.0/.configured_68b329da9893e34099c7d8ad5cb9c940
rm -f /home/dost/Documents/openwrt/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi//.built
touch /home/dost/Documents/openwrt/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi//.built_check
MAKEFLAGS="" /home/dost/Documents/openwrt/staging_dir/host/bin/ninja -v -j1 -C /home/dost/Documents/openwrt/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/mypackage-1.1.0.0
ninja: Entering directory `/home/dost/Documents/openwrt/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/mypackage-1.1.0.0'
ninja: error: loading 'build.ninja': No such file or directory
make[2]: *** [Makefile:44: /home/dost/Documents/openwrt/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi//.built] Error 1
make[2]: Leaving directory '/home/dost/Documents/openwrt/package/mypackage'

as observable it says --Build files have been written to: /home/dost/Documents/openwrt/package/mypackage which should not be the case