Debian Codegraph @

contrib/ports/unix/Filelists.cmake

raw
1 # This file is indended to be included in end-user CMakeLists.txt
2 # include(/path/to/Filelists.cmake)
3 # It assumes the variable LWIP_CONTRIB_DIR is defined pointing to the
4 # root path of lwIP/contrib sources.
5 #
6 # This file is NOT designed (on purpose) to be used as cmake
7 # subdir via add_subdirectory()
8 # The intention is to provide greater flexibility to users to
9 # create their own targets using the *_SRCS variables.
10
11 if(NOT ${CMAKE_VERSION} VERSION_LESS "3.10.0")
12 include_guard(GLOBAL)
13 endif()
14
15 set(lwipcontribportunix_SRCS
16 ${LWIP_CONTRIB_DIR}/ports/unix/port/sys_arch.c
17 ${LWIP_CONTRIB_DIR}/ports/unix/port/perf.c
18 )
19
20 set(lwipcontribportunixnetifs_SRCS
21 ${LWIP_CONTRIB_DIR}/ports/unix/port/netif/tapif.c
22 ${LWIP_CONTRIB_DIR}/ports/unix/port/netif/list.c
23 ${LWIP_CONTRIB_DIR}/ports/unix/port/netif/sio.c
24 ${LWIP_CONTRIB_DIR}/ports/unix/port/netif/fifo.c
25 )
26
27 add_library(lwipcontribportunix EXCLUDE_FROM_ALL ${lwipcontribportunix_SRCS} ${lwipcontribportunixnetifs_SRCS})
28 target_include_directories(lwipcontribportunix PRIVATE ${LWIP_INCLUDE_DIRS} ${LWIP_MBEDTLS_INCLUDE_DIRS})
29 target_compile_options(lwipcontribportunix PRIVATE ${LWIP_COMPILER_FLAGS})
30 target_compile_definitions(lwipcontribportunix PRIVATE ${LWIP_DEFINITIONS} ${LWIP_MBEDTLS_DEFINITIONS})
31 target_link_libraries(lwipcontribportunix PUBLIC ${LWIP_MBEDTLS_LINK_LIBRARIES})
32
33 if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
34 find_library(LIBUTIL util)
35 find_library(LIBPTHREAD pthread)
36 find_library(LIBRT rt)
37 target_link_libraries(lwipcontribportunix PUBLIC ${LIBUTIL} ${LIBPTHREAD} ${LIBRT})
38 endif()
39
40 if (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
41 # Darwin doesn't have pthreads or POSIX real-time extensions libs
42 find_library(LIBUTIL util)
43 target_link_libraries(lwipcontribportunix PUBLIC ${LIBUTIL})
44 endif()