2021-07-21 00:07:53 -04:00
|
|
|
idf_build_get_property(target IDF_TARGET)
|
|
|
|
if(NOT "${target}" STREQUAL "linux")
|
|
|
|
return()
|
|
|
|
endif()
|
|
|
|
|
2024-01-23 23:13:32 -05:00
|
|
|
set(includes "include")
|
2023-12-15 07:50:48 -05:00
|
|
|
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin")
|
2023-12-19 09:10:00 -05:00
|
|
|
list(APPEND srcs getrandom.c assert_func.c)
|
2024-01-23 23:13:32 -05:00
|
|
|
else()
|
|
|
|
list(APPEND srcs fls.c)
|
|
|
|
list(APPEND includes "linux_include")
|
2023-12-15 07:50:48 -05:00
|
|
|
endif()
|
|
|
|
|
2024-01-23 23:13:32 -05:00
|
|
|
idf_component_register(INCLUDE_DIRS ${includes}
|
2023-12-15 07:50:48 -05:00
|
|
|
REQUIRED_IDF_TARGETS linux
|
|
|
|
SRCS ${srcs})
|
2024-03-06 02:21:10 -05:00
|
|
|
|
|
|
|
if(${IDF_TARGET} STREQUAL "linux")
|
|
|
|
find_library(LIB_BSD bsd)
|
|
|
|
if(LIB_BSD)
|
|
|
|
target_link_libraries(${COMPONENT_LIB} PRIVATE ${LIB_BSD})
|
|
|
|
elseif(NOT CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin")
|
|
|
|
message(WARNING "Missing LIBBSD library. Install libbsd-dev package and/or check linker directories.")
|
|
|
|
endif()
|
|
|
|
endif()
|