@@ -77,7 +77,7 @@ if(("zephyr" STREQUAL ${ZEPHYR_TOOLCHAIN_VARIANT}) OR
77
77
# To support Zephyr SDK tools (DTC, and other tools) with 3rd party toolchains
78
78
# then we keep track of current toolchain variant.
79
79
set (ZEPHYR_CURRENT_TOOLCHAIN_VARIANT ${ZEPHYR_TOOLCHAIN_VARIANT} )
80
- find_package (Zephyr-sdk ${Zephyr-sdk_FIND_VERSION }
80
+ find_package (Zephyr-sdk ${Zephyr-sdk_FIND_VERSION_COMPLETE }
81
81
REQUIRED QUIET CONFIG HINTS ${ZEPHYR_SDK_INSTALL_DIR}
82
82
)
83
83
if (DEFINED ZEPHYR_CURRENT_TOOLCHAIN_VARIANT )
@@ -123,16 +123,27 @@ if(("zephyr" STREQUAL ${ZEPHYR_TOOLCHAIN_VARIANT}) OR
123
123
endif ()
124
124
endforeach ()
125
125
else ()
126
+ if ("${Zephyr-sdk_FIND_VERSION_RANGE_MAX}" STREQUAL "INCLUDE" )
127
+ set (upper_bound _EQUAL )
128
+ endif ()
129
+
130
+ if (NOT DEFINED Zephyr-sdk_FIND_VERSION_RANGE )
131
+ # Range not given, max out to ensure max version is not in effect.
132
+ set (Zephyr-sdk_FIND_VERSION_MAX 99999999 )
133
+ endif ()
134
+
126
135
# Loop over each found Zepher SDK version until one is found that is compatible.
127
136
foreach (zephyr_sdk_candidate ${Zephyr-sdk_CONSIDERED_VERSIONS} )
128
- if ("${zephyr_sdk_candidate} " VERSION_GREATER_EQUAL "${Zephyr-sdk_FIND_VERSION}" )
137
+ if ("${zephyr_sdk_candidate} " VERSION_GREATER_EQUAL "${Zephyr-sdk_FIND_VERSION}"
138
+ AND "${zephyr_sdk_candidate} " VERSION_LESS ${upper_bound} "${Zephyr-sdk_FIND_VERSION_MAX}"
139
+ )
129
140
# Find the path for the current version being checked and get the directory
130
141
# of the Zephyr SDK so it can be checked.
131
142
cmake_path (GET Zephyr-sdk-${zephyr_sdk_candidate}_DIR PARENT_PATH zephyr_sdk_current_check_path )
132
143
cmake_path (GET zephyr_sdk_current_check_path PARENT_PATH zephyr_sdk_current_check_path )
133
144
134
145
# Then see if this version is compatible.
135
- find_package (Zephyr-sdk ${Zephyr-sdk_FIND_VERSION } QUIET CONFIG PATHS ${zephyr_sdk_current_check_path} NO_DEFAULT_PATH )
146
+ find_package (Zephyr-sdk ${Zephyr-sdk_FIND_VERSION_COMPLETE } QUIET CONFIG PATHS ${zephyr_sdk_current_check_path} NO_DEFAULT_PATH )
136
147
137
148
if (${Zephyr-sdk_FOUND} )
138
149
# A compatible version of the Zephyr SDK has been found which is the highest
@@ -145,7 +156,7 @@ if(("zephyr" STREQUAL ${ZEPHYR_TOOLCHAIN_VARIANT}) OR
145
156
if (NOT ${Zephyr-sdk_FOUND} )
146
157
# This means no compatible Zephyr SDK versions were found, set the version
147
158
# back to the minimum version so that it is displayed in the error text.
148
- find_package (Zephyr-sdk ${Zephyr-sdk_FIND_VERSION } REQUIRED CONFIG PATHS ${zephyr_sdk_search_paths} )
159
+ find_package (Zephyr-sdk ${Zephyr-sdk_FIND_VERSION_COMPLETE } REQUIRED CONFIG PATHS ${zephyr_sdk_search_paths} )
149
160
endif ()
150
161
endif ()
151
162
endif ()
0 commit comments