Skip to content

Commit ea1b9db

Browse files
committed
cmake: Support both toolchain directory layouts
Until zephyrproject-rtos/sdk-ng#936 is merged, SDK 0.18 is incompatible with previous versions as the paths to find the cmake bits is different. Deal with that by checking for files in the wrong place as well as the right one. Signed-off-by: Keith Packard <keithp@keithp.com>
1 parent c08fa02 commit ea1b9db

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

cmake/toolchain/zephyr/generic.cmake

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22

33
if(TOOLCHAIN_VARIANT_COMPILER STREQUAL "gnu" OR
44
NOT DEFINED TOOLCHAIN_VARIANT_COMPILER)
5-
include(${ZEPHYR_SDK_INSTALL_DIR}/cmake/zephyr/gnu/generic.cmake)
5+
if(EXISTS ${ZEPHYR_SDK_INSTALL_DIR}/cmake/zephyr/gnu/generic.cmake)
6+
include(${ZEPHYR_SDK_INSTALL_DIR}/cmake/zephyr/gnu/generic.cmake)
7+
else()
8+
include(${ZEPHYR_SDK_INSTALL_DIR}/cmake/zephyr/generic.cmake)
9+
endif()
610
set(TOOLCHAIN_VARIANT_COMPILER "gnu" CACHE STRING "compiler used by the toolchain variant" FORCE)
711

812
set(TOOLCHAIN_KCONFIG_DIR ${ZEPHYR_SDK_INSTALL_DIR}/cmake/zephyr)

cmake/toolchain/zephyr/target.cmake

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33
if(TOOLCHAIN_VARIANT_COMPILER STREQUAL "gnu" OR
44
TOOLCHAIN_VARIANT_COMPILER STREQUAL "default")
55
set(TOOLCHAIN_VARIANT_COMPILER gnu CACHE STRING "Variant compiler being used")
6-
include(${ZEPHYR_SDK_INSTALL_DIR}/cmake/zephyr/gnu/target.cmake)
6+
if(EXISTS ${ZEPHYR_SDK_INSTALL_DIR}/cmake/zephyr/gnu/target.cmake)
7+
include(${ZEPHYR_SDK_INSTALL_DIR}/cmake/zephyr/gnu/target.cmake)
8+
else()
9+
include(${ZEPHYR_SDK_INSTALL_DIR}/cmake/zephyr/target.cmake)
10+
endif()
711
elseif (TOOLCHAIN_VARIANT_COMPILER STREQUAL "llvm")
812
set(TOOLCHAIN_VARIANT_COMPILER llvm CACHE STRING "Variant compiler being used")
913
include(${ZEPHYR_SDK_INSTALL_DIR}/cmake/zephyr/llvm/target.cmake)

0 commit comments

Comments
 (0)