• source navigation  • diff markup  • identifier search  • freetext search  • 

Sources/uclient/CMakeLists.txt

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

This page was automatically generated by LXR 0.3.1.  •  OpenWrt