• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1if(ENABLE_EXAMPLES)
2  file(GLOB c_sources *.c)
3  set_source_files_properties(${c_sources} PROPERTIES
4    COMPILE_FLAGS "${WARNCFLAGS}")
5  file(GLOB cxx_sources *.cc)
6  set_source_files_properties(${cxx_sources} PROPERTIES
7    COMPILE_FLAGS "${WARNCXXFLAGS} ${CXX1XCXXFLAGS}")
8
9  include_directories(
10    ${CMAKE_CURRENT_SOURCE_DIR}
11    "${CMAKE_CURRENT_SOURCE_DIR}/../third-party"
12    "${CMAKE_CURRENT_SOURCE_DIR}/../third-party/llhttp/include"
13
14    ${LIBEVENT_INCLUDE_DIRS}
15    ${OPENSSL_INCLUDE_DIRS}
16  )
17
18  link_libraries(
19    nghttp2
20    ${LIBEVENT_OPENSSL_LIBRARIES}
21    ${OPENSSL_LIBRARIES}
22    ${APP_LIBRARIES}
23  )
24
25  add_executable(client           client.c $<TARGET_OBJECTS:llhttp>
26    $<TARGET_OBJECTS:url-parser>
27  )
28  add_executable(libevent-client  libevent-client.c $<TARGET_OBJECTS:llhttp>
29    $<TARGET_OBJECTS:url-parser>
30  )
31  add_executable(libevent-server  libevent-server.c $<TARGET_OBJECTS:llhttp>
32    $<TARGET_OBJECTS:url-parser>
33  )
34  add_executable(deflate          deflate.c $<TARGET_OBJECTS:llhttp>
35    $<TARGET_OBJECTS:url-parser>
36  )
37
38  if(ENABLE_ASIO_LIB)
39    foreach(name asio-sv asio-sv2 asio-cl asio-cl2)
40      add_executable(${name} ${name}.cc $<TARGET_OBJECTS:llhttp>
41        $<TARGET_OBJECTS:url-parser>
42      )
43      target_include_directories(${name} PRIVATE
44        ${OPENSSL_INCLUDE_DIRS}
45        ${Boost_INCLUDE_DIRS}
46      )
47      target_link_libraries(${name}
48        nghttp2
49        nghttp2_asio
50        ${JEMALLOC_LIBRARIES}
51        ${OPENSSL_LIBRARIES}
52        ${Boost_LIBRARIES}
53        ${APP_LIBRARIES}
54      )
55    endforeach()
56  endif()
57endif()
58