feat(linux): provide getrandom implementation for macOS

This makes getrandom(2) usable when compiling with IDF_TARGET=linux
on a macOS host.
This commit is contained in:
Ivan Grokhotkov
2023-12-15 13:50:48 +01:00
parent a596ca56a8
commit 7b8f69404f
3 changed files with 49 additions and 1 deletions

View File

@@ -3,5 +3,10 @@ if(NOT "${target}" STREQUAL "linux")
return()
endif()
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin")
list(APPEND srcs getrandom.c)
endif()
idf_component_register(INCLUDE_DIRS include
REQUIRED_IDF_TARGETS linux)
REQUIRED_IDF_TARGETS linux
SRCS ${srcs})