mirror of
https://github.com/espressif/openthread.git
synced 2026-07-30 23:57:47 +00:00
[cmake] fix OT_THREAD_VERSION comparison in CMake (#9158)
This commit fixes the check for CMake `OT_THREAD_VERSION` against
different version strings ("1.1", 1.2", "1.3", and "1.3.1"). The
previous check used `EQUAL`, which would do a numerical match and
would treat `1.3` and `1.3.1` as equal. This commit changes the check
to use `STREQUAL`, which does a string match and will correctly
distinguish between `1.3` and `1.3.1`.
This commit also adds new `message(STATUS)` commands to output the
selected Thread version. This makes it easier to see which version of
Thread is being built.
This commit is contained in:
+8
-4
@@ -108,14 +108,18 @@ message(STATUS "Package Version: ${OT_PACKAGE_VERSION}")
|
||||
|
||||
set(OT_THREAD_VERSION "1.3" CACHE STRING "Thread version chosen by the user at configure time")
|
||||
set_property(CACHE OT_THREAD_VERSION PROPERTY STRINGS "1.1" "1.2" "1.3" "1.3.1")
|
||||
if(${OT_THREAD_VERSION} EQUAL "1.1")
|
||||
if(${OT_THREAD_VERSION} STREQUAL "1.1")
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_THREAD_VERSION=OT_THREAD_VERSION_1_1")
|
||||
elseif(${OT_THREAD_VERSION} EQUAL "1.2")
|
||||
message(STATUS "Thread Version: 1.1 (OPENTHREAD_CONFIG_THREAD_VERSION=OT_THREAD_VERSION_1_1)")
|
||||
elseif(${OT_THREAD_VERSION} STREQUAL "1.2")
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_THREAD_VERSION=OT_THREAD_VERSION_1_2")
|
||||
elseif(${OT_THREAD_VERSION} EQUAL "1.3")
|
||||
message(STATUS "Thread Version: 1.2 (OPENTHREAD_CONFIG_THREAD_VERSION=OT_THREAD_VERSION_1_2)")
|
||||
elseif(${OT_THREAD_VERSION} STREQUAL "1.3")
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_THREAD_VERSION=OT_THREAD_VERSION_1_3")
|
||||
elseif(${OT_THREAD_VERSION} EQUAL "1.3.1")
|
||||
message(STATUS "Thread Version: 1.3 (OPENTHREAD_CONFIG_THREAD_VERSION=OT_THREAD_VERSION_1_3)")
|
||||
elseif(${OT_THREAD_VERSION} STREQUAL "1.3.1")
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_THREAD_VERSION=OT_THREAD_VERSION_1_3_1")
|
||||
message(STATUS "Thread Version: 1.3.1 (OPENTHREAD_CONFIG_THREAD_VERSION=OT_THREAD_VERSION_1_3_1)")
|
||||
else()
|
||||
message(FATAL_ERROR "Thread version unknown: ${OT_THREAD_VERSION}")
|
||||
endif()
|
||||
|
||||
@@ -42,6 +42,7 @@ message(STATUS OT_APP_RCP=${OT_APP_RCP})
|
||||
message(STATUS OT_FTD=${OT_FTD})
|
||||
message(STATUS OT_MTD=${OT_MTD})
|
||||
message(STATUS OT_RCP=${OT_RCP})
|
||||
message(STATUS OT_THREAD_VERSION=${OT_THREAD_VERSION})
|
||||
|
||||
set(OT_CONFIG_VALUES
|
||||
""
|
||||
|
||||
Reference in New Issue
Block a user