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!
Parents Reply
  • Hello again, I've been trying to find a solution to this. Our developers want to know the reason for setting this in the CmakeFile? There seems to be an issue with west but unfortunately there is no work around at the moment. 

    If you remove set(board nrf5340dk_nrf5340_cpuapp) from CmakeLists.txt and build using west build -b nrf5340dk_nrf5340_cpuapp -d build, do you have any issues?

Children
Related