Help with error: cmake:2891 (message):BOARD is not being defined on the CMake command-line,

Hi, 

I am getting the following error:
CMake Error at C:/ncs/v2.6.1/zephyr/cmake/modules/extensions.cmake:2891 (message):BOARD is not being defined on the CMake command-line, in the environment or
by the app.

I have explicitly added "set(board nrf5340dk_nrf5340)" to the cmake file in an attempt to fix it, but to no avail.
//---------------------------------------- cmake.txt ---------------------------------------------------------------- 

# SPDX-License-Identifier: Apache-2.0


cmake_minimum_required(VERSION 3.20.0)
set(board nrf5340dk_nrf5340)
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(blinky_pwm)

target_sources(app PRIVATE src/main.c)
//---------------------------------------- cmake.txt ---------------------------------------------------------------- 
I have even tried adding the path to the overlay file in the build config using "-DBOARD="c/...."   
//--------------------------------------- cmake debug detail ----------------------------------------------------------------
Detailed cmake error is:
Exception has occurred: FATAL_ERROR
CMake Error at C:/ncs/v2.6.1/zephyr/cmake/modules/extensions.cmake:2891 (message): BOARD is not being defined on the CMake command-line, in the environment or by the app. Call Stack (most recent call first): C:/ncs/v2.6.1/zephyr/cmake/modules/boards.cmake:56 (zephyr_check_cache) C:/ncs/v2.6.1/zephyr/cmake/modules/zephyr_default.cmake:129 (include) C:/ncs/v2.6.1/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include) C:/ncs/v2.6.1/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:97 (include_boilerplate) CMakeLists.txt:5 (find_package)
//--------------------------------------- cmake debug detail ----------------------------------------------------------------
Please guide.
Thx!
Related