cmake: zephyr toolchain code cleanup

With the revert of commit 820d327b4618d587a9cae0d085f00c6ab9c81cf2 then
some additional code can be cleaned up.

This removes the final left-overs from Zephyr SDK 0.11.1 support and
older.

It further aligns message printing when including Zephyr SDK toolchain
to other toolchain message printing.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
This commit is contained in:
Torsten Rasmussen 2021-12-15 21:31:58 +01:00 committed by Carles Cufí
commit fb3a113eb8
4 changed files with 14 additions and 18 deletions

View file

@ -1,6 +1,8 @@
# SPDX-License-Identifier: Apache-2.0
include(${ZEPHYR_BASE}/cmake/toolchain/zephyr/host-tools.cmake)
if(ZEPHYR_SDK_HOST_TOOLS)
include(${ZEPHYR_BASE}/cmake/toolchain/zephyr/host-tools.cmake)
endif()
# dtc is an optional dependency
find_program(

View file

@ -3,3 +3,5 @@
include(${ZEPHYR_SDK_INSTALL_DIR}/cmake/zephyr/generic.cmake)
set(TOOLCHAIN_KCONFIG_DIR ${ZEPHYR_SDK_INSTALL_DIR}/cmake/zephyr)
message(STATUS "Found toolchain: zephyr ${SDK_VERSION} (${ZEPHYR_SDK_INSTALL_DIR})")

View file

@ -1,15 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
if(NOT DEFINED ZEPHYR_SDK_INSTALL_DIR)
# Until https://github.com/zephyrproject-rtos/zephyr/issues/4912 is
# resolved we use ZEPHYR_SDK_INSTALL_DIR to determine whether the user
# wants to use the Zephyr SDK or not.
return()
endif()
# Cache the Zephyr SDK install dir.
set(ZEPHYR_SDK_INSTALL_DIR ${ZEPHYR_SDK_INSTALL_DIR} CACHE PATH "Zephyr SDK install directory")
message(STATUS "Using toolchain: zephyr ${SDK_VERSION} (${ZEPHYR_SDK_INSTALL_DIR})")
include(${ZEPHYR_SDK_INSTALL_DIR}/cmake/zephyr/host-tools.cmake)
message(STATUS "Found host-tools: zephyr ${SDK_VERSION} (${ZEPHYR_SDK_INSTALL_DIR})")

View file

@ -90,10 +90,6 @@ if(NOT DEFINED ZEPHYR_TOOLCHAIN_VARIANT)
if (NOT Zephyr-sdk_CONSIDERED_VERSIONS)
set(error_msg "ZEPHYR_TOOLCHAIN_VARIANT not specified and no Zephyr SDK is installed.\n")
string(APPEND error_msg "Please set ZEPHYR_TOOLCHAIN_VARIANT to the toolchain to use or install the Zephyr SDK.")
if(NOT ZEPHYR_TOOLCHAIN_VARIANT AND NOT ZEPHYR_SDK_INSTALL_DIR)
set(error_note "Note: If you are using Zephyr SDK 0.11.1 or 0.11.2, remember to set ZEPHYR_SDK_INSTALL_DIR and ZEPHYR_TOOLCHAIN_VARIANT")
endif()
else()
# Note: When CMake mimimun version becomes >= 3.17, change this loop into:
# foreach(version config IN ZIP_LISTS Zephyr-sdk_CONSIDERED_VERSIONS Zephyr-sdk_CONSIDERED_CONFIGS)
@ -116,11 +112,17 @@ if(NOT DEFINED ZEPHYR_TOOLCHAIN_VARIANT)
message(FATAL_ERROR "${error_msg}
The Zephyr SDK can be downloaded from:
https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v${TOOLCHAIN_ZEPHYR_MINIMUM_REQUIRED_VERSION}/zephyr-sdk-${TOOLCHAIN_ZEPHYR_MINIMUM_REQUIRED_VERSION}-setup.run
${error_note}
")
endif()
if(DEFINED ZEPHYR_SDK_INSTALL_DIR)
# Cache the Zephyr SDK install dir.
set(ZEPHYR_SDK_INSTALL_DIR ${ZEPHYR_SDK_INSTALL_DIR} CACHE PATH "Zephyr SDK install directory")
# Use the Zephyr SDK host-tools.
set(ZEPHYR_SDK_HOST_TOOLS TRUE)
endif()
if(CMAKE_SCRIPT_MODE_FILE)
if("${FORMAT}" STREQUAL "json")
set(json "{\"ZEPHYR_TOOLCHAIN_VARIANT\" : \"${ZEPHYR_TOOLCHAIN_VARIANT}\", ")