blob: f0388abefe2592afb65dc78cd814f8eee1ca2821 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
cmake_minimum_required(VERSION 2.6)
INCLUDE(CheckIncludeFiles)
PROJECT(uclient C)
ADD_DEFINITIONS(-Os -Wall -Werror --std=gnu99 -g3 -Wmissing-declarations)
SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
FIND_PATH(ubox_include_dir libubox/ustream-ssl.h)
INCLUDE_DIRECTORIES(${ubox_include_dir})
IF(BUILD_STATIC)
FIND_LIBRARY(ubox_library NAMES ubox.a)
ELSE(BUILD_STATIC)
FIND_LIBRARY(ubox_library NAMES ubox)
ENDIF(BUILD_STATIC)
SET(LIB_SOURCES uclient.c uclient-http.c uclient-utils.c)
ADD_LIBRARY(uclient SHARED ${LIB_SOURCES})
TARGET_LINK_LIBRARIES(uclient ${ubox_library} dl)
SET(CLI_SOURCES uclient-fetch.c progress.c)
ADD_EXECUTABLE(uclient-fetch ${CLI_SOURCES})
TARGET_LINK_LIBRARIES(uclient-fetch uclient)
IF(UNIT_TESTING)
ADD_DEFINITIONS(-DUNIT_TESTING)
ENABLE_TESTING()
ADD_SUBDIRECTORY(tests)
IF(CMAKE_C_COMPILER_ID STREQUAL "Clang")
ADD_LIBRARY(uclient-san SHARED ${LIB_SOURCES})
TARGET_COMPILE_OPTIONS(uclient-san PRIVATE -g -fno-omit-frame-pointer -fsanitize=undefined,address,leak -fno-sanitize-recover=all)
TARGET_LINK_OPTIONS(uclient-san PRIVATE -fsanitize=undefined,address,leak)
TARGET_LINK_LIBRARIES(uclient-san ${ubox_library} dl)
ADD_EXECUTABLE(uclient-fetch-san ${CLI_SOURCES})
TARGET_COMPILE_OPTIONS(uclient-fetch-san PRIVATE -g -fno-omit-frame-pointer -fsanitize=undefined,address,leak -fno-sanitize-recover=all)
TARGET_LINK_OPTIONS(uclient-fetch-san PRIVATE -fsanitize=undefined,address,leak)
TARGET_LINK_LIBRARIES(uclient-fetch-san uclient-san ${ubox_library} dl)
ENDIF()
ENDIF()
INSTALL(FILES uclient.h uclient-utils.h
DESTINATION include/libubox
)
INSTALL(TARGETS uclient uclient-fetch
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
)
|