• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1add_subdirectory(includes)
2
3include_directories(
4  "${CMAKE_CURRENT_SOURCE_DIR}/includes"
5  "${CMAKE_CURRENT_BINARY_DIR}/includes"
6)
7
8add_definitions(-DBUILDING_NGHTTP2)
9
10set(NGHTTP2_SOURCES
11  nghttp2_pq.c nghttp2_map.c nghttp2_queue.c
12  nghttp2_frame.c
13  nghttp2_buf.c
14  nghttp2_stream.c nghttp2_outbound_item.c
15  nghttp2_session.c nghttp2_submit.c
16  nghttp2_helper.c
17  nghttp2_npn.c
18  nghttp2_hd.c nghttp2_hd_huffman.c nghttp2_hd_huffman_data.c
19  nghttp2_version.c
20  nghttp2_priority_spec.c
21  nghttp2_option.c
22  nghttp2_callbacks.c
23  nghttp2_mem.c
24  nghttp2_http.c
25  nghttp2_rcbuf.c
26  nghttp2_extpri.c
27  nghttp2_debug.c
28)
29
30set(NGHTTP2_RES "")
31
32if(WIN32)
33  configure_file(
34    version.rc.in
35    ${CMAKE_CURRENT_BINARY_DIR}/version.rc
36    @ONLY)
37
38  set(NGHTTP2_RES ${CMAKE_CURRENT_BINARY_DIR}/version.rc)
39endif()
40
41# Public shared library
42if(ENABLE_SHARED_LIB)
43  add_library(nghttp2 SHARED ${NGHTTP2_SOURCES} ${NGHTTP2_RES})
44  set_target_properties(nghttp2 PROPERTIES
45    COMPILE_FLAGS "${WARNCFLAGS}"
46    VERSION ${LT_VERSION} SOVERSION ${LT_SOVERSION}
47    C_VISIBILITY_PRESET hidden
48  )
49  target_include_directories(nghttp2 INTERFACE
50    "${CMAKE_CURRENT_BINARY_DIR}/includes"
51    "${CMAKE_CURRENT_SOURCE_DIR}/includes"
52  )
53
54  install(TARGETS nghttp2
55    ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
56    LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
57    RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
58endif()
59
60if(HAVE_CUNIT OR ENABLE_STATIC_LIB)
61  # Static library (for unittests because of symbol visibility)
62  add_library(nghttp2_static STATIC ${NGHTTP2_SOURCES})
63  set_target_properties(nghttp2_static PROPERTIES
64    COMPILE_FLAGS "${WARNCFLAGS}"
65    VERSION ${LT_VERSION} SOVERSION ${LT_SOVERSION}
66    ARCHIVE_OUTPUT_NAME nghttp2${STATIC_LIB_SUFFIX}
67  )
68  target_compile_definitions(nghttp2_static PUBLIC "-DNGHTTP2_STATICLIB")
69  if(ENABLE_STATIC_LIB)
70    install(TARGETS nghttp2_static
71      DESTINATION "${CMAKE_INSTALL_LIBDIR}")
72  endif()
73endif()
74
75
76install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libnghttp2.pc"
77  DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
78