Imported Upstream version 1.41.0
[platform/upstream/nghttp2.git] / lib / CMakeLists.txt
1 add_subdirectory(includes)
2
3 include_directories(
4   "${CMAKE_CURRENT_SOURCE_DIR}/includes"
5   "${CMAKE_CURRENT_BINARY_DIR}/includes"
6 )
7
8 add_definitions(-DBUILDING_NGHTTP2)
9
10 set(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_debug.c
27 )
28
29 set(NGHTTP2_RES "")
30
31 if(WIN32)
32   configure_file(
33     version.rc.in
34     ${CMAKE_CURRENT_BINARY_DIR}/version.rc
35     @ONLY)
36
37   set(NGHTTP2_RES ${CMAKE_CURRENT_BINARY_DIR}/version.rc)
38 endif()
39
40 # Public shared library
41 if(ENABLE_SHARED_LIB)
42   add_library(nghttp2 SHARED ${NGHTTP2_SOURCES} ${NGHTTP2_RES})
43   set_target_properties(nghttp2 PROPERTIES
44     COMPILE_FLAGS "${WARNCFLAGS}"
45     VERSION ${LT_VERSION} SOVERSION ${LT_SOVERSION}
46     C_VISIBILITY_PRESET hidden
47   )
48   target_include_directories(nghttp2 INTERFACE
49     "${CMAKE_CURRENT_BINARY_DIR}/includes"
50     "${CMAKE_CURRENT_SOURCE_DIR}/includes"
51   )
52
53   install(TARGETS nghttp2
54     ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
55     LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
56     RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
57 endif()
58
59 if(HAVE_CUNIT OR ENABLE_STATIC_LIB)
60   # Static library (for unittests because of symbol visibility)
61   add_library(nghttp2_static STATIC ${NGHTTP2_SOURCES})
62   set_target_properties(nghttp2_static PROPERTIES
63     COMPILE_FLAGS "${WARNCFLAGS}"
64     VERSION ${LT_VERSION} SOVERSION ${LT_SOVERSION}
65     ARCHIVE_OUTPUT_NAME nghttp2${STATIC_LIB_SUFFIX}
66   )
67   target_compile_definitions(nghttp2_static PUBLIC "-DNGHTTP2_STATICLIB")
68   if(ENABLE_STATIC_LIB)
69     install(TARGETS nghttp2_static
70       DESTINATION "${CMAKE_INSTALL_LIBDIR}")
71   endif()
72 endif()
73
74
75 install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libnghttp2.pc"
76   DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")