mirror of
https://github.com/espressif/openthread.git
synced 2026-10-01 21:37:39 +00:00
[cmake] auto choose readline library (#6251)
This commit is contained in:
@@ -38,15 +38,32 @@ set(COMMON_INCLUDES
|
|||||||
${PROJECT_SOURCE_DIR}/src/posix/platform/include
|
${PROJECT_SOURCE_DIR}/src/posix/platform/include
|
||||||
)
|
)
|
||||||
|
|
||||||
set(OT_READLINE "readline" CACHE STRING "set readline library name")
|
set(OT_READLINE_VALUES
|
||||||
set_property(CACHE OT_READLINE PROPERTY STRINGS "readline" "edit")
|
"readline"
|
||||||
|
"edit"
|
||||||
|
)
|
||||||
|
|
||||||
if(OT_READLINE)
|
set(OT_READLINE "" CACHE STRING "set readline library name")
|
||||||
|
set_property(CACHE OT_READLINE PROPERTY STRINGS ${OT_READLINE_VALUES})
|
||||||
|
|
||||||
|
if(OT_READLINE STREQUAL "")
|
||||||
|
foreach(X IN LISTS OT_READLINE_VALUES)
|
||||||
|
find_library(READLINE ${X})
|
||||||
|
if (READLINE)
|
||||||
|
set(OT_READLINE ${X})
|
||||||
|
break()
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
elseif(OT_READLINE)
|
||||||
find_library(READLINE ${OT_READLINE})
|
find_library(READLINE ${OT_READLINE})
|
||||||
|
|
||||||
if (NOT READLINE)
|
if (NOT READLINE)
|
||||||
message(FATAL_ERROR "Failed to find ${OT_READLINE}")
|
message(FATAL_ERROR "Failed to find ${OT_READLINE}")
|
||||||
endif()
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (READLINE)
|
||||||
|
message(STATUS "Readline: ${OT_READLINE}")
|
||||||
|
|
||||||
find_library(NCURSES ncurses)
|
find_library(NCURSES ncurses)
|
||||||
if (NOT NCURSES)
|
if (NOT NCURSES)
|
||||||
|
|||||||
Reference in New Issue
Block a user