[cmake] add posix in platform list (#5071)

- rename "none" to NO, which computes to false in if()
- sort platform names
- add "posix" into the platform list so that it can be selected from cmake-gui
This commit is contained in:
Yakun Xu
2020-06-10 07:14:10 +08:00
committed by GitHub
parent bc9745584b
commit dce84a77fb
2 changed files with 10 additions and 10 deletions

View File

@ -90,13 +90,11 @@ else()
message(FATAL_ERROR "Thread version unknown: ${OT_THREAD_VERSION}")
endif()
set(OT_PLATFORM "none" CACHE STRING "Target platform chosen by the user at configure time")
ot_get_platforms(OT_EXAMPLE_PLATFORMS)
set_property(CACHE OT_PLATFORM PROPERTY STRINGS ${OT_EXAMPLE_PLATFORMS})
if(NOT OT_PLATFORM IN_LIST OT_EXAMPLE_PLATFORMS)
if(NOT OT_PLATFORM STREQUAL "posix")
message(FATAL_ERROR "Platform unknown: ${OT_PLATFORM}")
endif()
set(OT_PLATFORM "NO" CACHE STRING "Target platform chosen by the user at configure time")
ot_get_platforms(OT_PLATFORMS)
set_property(CACHE OT_PLATFORM PROPERTY STRINGS ${OT_PLATFORMS})
if(NOT OT_PLATFORM IN_LIST OT_PLATFORMS)
message(FATAL_ERROR "Platform unknown: ${OT_PLATFORM}")
endif()
set(OT_LOG_OUTPUT_VALUES
@ -135,7 +133,7 @@ list(APPEND OT_PUBLIC_INCLUDES ${PROJECT_SOURCE_DIR}/include)
if(OT_PLATFORM STREQUAL "posix")
list(APPEND OT_PRIVATE_INCLUDES ${PROJECT_SOURCE_DIR}/src/posix/platform)
add_subdirectory("${PROJECT_SOURCE_DIR}/src/posix/platform")
elseif(NOT OT_PLATFORM MATCHES "none")
elseif(OT_PLATFORM)
list(APPEND OT_PRIVATE_INCLUDES ${PROJECT_SOURCE_DIR}/examples/platforms/${OT_PLATFORM})
add_subdirectory("${PROJECT_SOURCE_DIR}/examples/platforms/${OT_PLATFORM}")
endif()
@ -153,7 +151,7 @@ if(OT_PLATFORM STREQUAL "posix")
else()
add_subdirectory(src/posix EXCLUDE_FROM_ALL)
endif()
elseif(NOT OT_PLATFORM MATCHES "none")
elseif(OT_PLATFORM)
add_subdirectory(examples)
endif()