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_ratelim.c 28 nghttp2_time.c 29 nghttp2_debug.c 30 sfparse.c 31) 32 33set(NGHTTP2_RES "") 34 35if(WIN32) 36 configure_file( 37 version.rc.in 38 ${CMAKE_CURRENT_BINARY_DIR}/version.rc 39 @ONLY) 40 41 set(NGHTTP2_RES ${CMAKE_CURRENT_BINARY_DIR}/version.rc) 42endif() 43 44# Public shared library 45if(ENABLE_SHARED_LIB) 46 add_library(nghttp2 SHARED ${NGHTTP2_SOURCES} ${NGHTTP2_RES}) 47 set_target_properties(nghttp2 PROPERTIES 48 COMPILE_FLAGS "${WARNCFLAGS}" 49 VERSION ${LT_VERSION} SOVERSION ${LT_SOVERSION} 50 C_VISIBILITY_PRESET hidden 51 ) 52 target_include_directories(nghttp2 INTERFACE 53 "${CMAKE_CURRENT_BINARY_DIR}/includes" 54 "${CMAKE_CURRENT_SOURCE_DIR}/includes" 55 ) 56 57 install(TARGETS nghttp2 58 ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" 59 LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" 60 RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") 61endif() 62 63if(HAVE_CUNIT OR ENABLE_STATIC_LIB) 64 # Static library (for unittests because of symbol visibility) 65 add_library(nghttp2_static STATIC ${NGHTTP2_SOURCES}) 66 set_target_properties(nghttp2_static PROPERTIES 67 COMPILE_FLAGS "${WARNCFLAGS}" 68 VERSION ${LT_VERSION} SOVERSION ${LT_SOVERSION} 69 ARCHIVE_OUTPUT_NAME nghttp2${STATIC_LIB_SUFFIX} 70 ) 71 target_compile_definitions(nghttp2_static PUBLIC "-DNGHTTP2_STATICLIB") 72 if(ENABLE_STATIC_LIB) 73 install(TARGETS nghttp2_static 74 DESTINATION "${CMAKE_INSTALL_LIBDIR}") 75 endif() 76endif() 77 78 79install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libnghttp2.pc" 80 DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") 81