source: azure_iot_hub_f767zi/trunk/asp_baseplatform/lwip/contrib-2.1.0/ports/unix/check/CMakeLists.txt@ 457

Last change on this file since 457 was 457, checked in by coas-nagasima, 4 years ago

ファイルを追加

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/plain;charset=UTF-8
File size: 2.1 KB
Line 
1cmake_minimum_required(VERSION 3.8)
2
3project(lwipunittests C)
4
5if (NOT CMAKE_SYSTEM_NAME STREQUAL Linux AND NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
6 message(FATAL_ERROR "Unit test are currently only working on Linux or Darwin")
7endif()
8
9set(LWIP_CONTRIB_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../..)
10set(LWIP_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../../../lwip)
11
12set(LWIP_USE_SANITIZERS true)
13include(${LWIP_CONTRIB_DIR}/ports/CMakeCommon.cmake)
14
15if(CMAKE_C_COMPILER_ID STREQUAL Clang)
16 # check.h causes 'error: token pasting of ',' and __VA_ARGS__ is a GNU extension' with clang 9.0.0
17 list(LWIP_COMPILER_FLAGS APPEND -Wno-gnu-zero-variadic-macro-arguments)
18endif()
19
20set (LWIP_DEFINITIONS -DLWIP_DEBUG -DLWIP_NOASSERT_ON_ERROR)
21set (LWIP_INCLUDE_DIRS
22 "${LWIP_DIR}/test/unit"
23 "${LWIP_DIR}/src/include"
24 "${LWIP_CONTRIB_DIR}/"
25 "${LWIP_CONTRIB_DIR}/ports/unix/port/include"
26 "${CMAKE_CURRENT_SOURCE_DIR}/"
27)
28
29include(${LWIP_CONTRIB_DIR}/ports/unix/Filelists.cmake)
30include(${LWIP_DIR}/src/Filelists.cmake)
31include(${LWIP_DIR}/test/unit/Filelists.cmake)
32
33add_executable(lwip_unittests ${LWIP_TESTFILES})
34target_include_directories(lwip_unittests PRIVATE ${LWIP_INCLUDE_DIRS})
35target_compile_options(lwip_unittests PRIVATE ${LWIP_COMPILER_FLAGS})
36target_compile_definitions(lwip_unittests PRIVATE ${LWIP_DEFINITIONS} ${LWIP_MBEDTLS_DEFINITIONS})
37
38find_library(LIBCHECK check)
39find_library(LIBM m)
40target_link_libraries(lwip_unittests ${LWIP_SANITIZER_LIBS} lwipallapps lwipcore ${LIBCHECK} ${LIBM})
41
42if (NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
43 # check installed via brew on Darwin doesn't have a separate subunit library (must be statically linked)
44 find_library(LIBSUBUNIT subunit)
45 target_link_libraries(lwip_unittests ${LIBSUBUNIT})
46endif()
47
48if (CMAKE_SYSTEM_NAME STREQUAL Linux)
49 find_library(LIBUTIL util)
50 find_library(LIBPTHREAD pthread)
51 find_library(LIBRT rt)
52 target_link_libraries(lwip_unittests ${LIBUTIL} ${LIBPTHREAD} ${LIBRT})
53endif()
54
55if (CMAKE_SYSTEM_NAME STREQUAL Darwin)
56 # Darwin doesn't have pthreads or POSIX real-time extensions libs
57 find_library(LIBUTIL util)
58 target_link_libraries(lwip_unittests ${LIBUTIL})
59endif()
Note: See TracBrowser for help on using the repository browser.