Browse Source

cmake: FindHostTools: Fix for hwmv2 for host based targets

With hwmv2, the ARCH variable is not yet defined
when this module is loaded (kconfig is parsed after this).
So we cannot rely on it to detect if we are building for a
host target.
For this case, let's instead detect it by the BOARD or
BOARD_DIR which are some of the very few things defined
at this point.
We retain the old check to support hwmv1 boards which
may be in other folders.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
pull/69687/head
Alberto Escolar Piedras 1 year ago committed by Carles Cufi
parent
commit
9a32559a2d
  1. 5
      cmake/modules/FindHostTools.cmake

5
cmake/modules/FindHostTools.cmake

@ -65,8 +65,9 @@ find_program(BOSSAC bossac) @@ -65,8 +65,9 @@ find_program(BOSSAC bossac)
# in the mcuboot repository if that's present in some cases)
find_program(IMGTOOL imgtool)
# Pick host system's toolchain if we are targeting posix
if("${ARCH}" STREQUAL "posix" OR "${ARCH}" STREQUAL "unit_testing")
# Default to the host system's toolchain if we are targeting a host based target
if((${BOARD_DIR} MATCHES "boards\/native") OR ("${ARCH}" STREQUAL "posix")
OR ("${BOARD}" STREQUAL "unit_testing"))
if(NOT "${ZEPHYR_TOOLCHAIN_VARIANT}" STREQUAL "llvm")
set(ZEPHYR_TOOLCHAIN_VARIANT "host")
endif()

Loading…
Cancel
Save