tangentia

CMakeLists - mod_http2-2.0.42.txt

Mar 8th, 2026 (edited)
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CMake 4.42 KB | None | 0 0
  1. # CMakeLists.txt file for MOD_HTTP2 - 2026-05-26
  2. #
  3. CMAKE_MINIMUM_REQUIRED(VERSION 3.15)
  4.  
  5. PROJECT(mod_http2 C)
  6.  
  7. IF(NOT EXISTS ${CMAKE_INSTALL_PREFIX}/lib/libhttpd.lib)
  8.   MESSAGE(FATAL_ERROR "libhttpd.lib was not found in prefix ${CMAKE_INSTALL_PREFIX}")
  9. ENDIF()
  10.  
  11. # Select APR trunk (libapr-2.lib) if it exists in PREFIX/lib; otherwise, select
  12. # APR 1.x + APR-util 1.x
  13. #
  14. IF(EXISTS "${CMAKE_INSTALL_PREFIX}/lib/libapr-2.lib")
  15.   SET(apr_libraries
  16.     ${CMAKE_INSTALL_PREFIX}/lib/libapr-2.lib)
  17. ELSEIF(EXISTS "${CMAKE_INSTALL_PREFIX}/lib/libapr-1.lib")
  18.   SET(apr_libraries
  19.     ${CMAKE_INSTALL_PREFIX}/lib/libapr-1.lib
  20.     ${CMAKE_INSTALL_PREFIX}/lib/libaprutil-1.lib)
  21. ELSE()
  22.   MESSAGE(FATAL_ERROR "APR libraries were not found in prefix ${CMAKE_INSTALL_PREFIX}")
  23. ENDIF()
  24.  
  25. IF(EXISTS ${CMAKE_INSTALL_PREFIX}/lib/libcrypto.lib)
  26.   SET(crypto_libraries
  27.       ${CMAKE_INSTALL_PREFIX}/lib/libcrypto.lib)
  28. ELSE()
  29.   MESSAGE(FATAL_ERROR "libcrypto.lib was not found in prefix ${CMAKE_INSTALL_PREFIX}")
  30. ENDIF()
  31.  
  32. IF(EXISTS ${CMAKE_INSTALL_PREFIX}/lib/mod_proxy.lib)
  33.   SET(mod_proxy_libraries
  34.     ${CMAKE_INSTALL_PREFIX}/lib/mod_proxy.lib)
  35. ELSE()
  36.   MESSAGE(FATAL_ERROR "mod_proxy.lib was not found in prefix ${CMAKE_INSTALL_PREFIX}")
  37. ENDIF()
  38.  
  39. IF(EXISTS ${CMAKE_INSTALL_PREFIX}/lib/nghttp2.lib)
  40.   SET(nghttp2_libraries
  41.     ${CMAKE_INSTALL_PREFIX}/lib/nghttp2.lib)
  42. ELSE()
  43.   MESSAGE(FATAL_ERROR "nghttp2.lib was not found in prefix ${CMAKE_INSTALL_PREFIX}")
  44. ENDIF()
  45.  
  46. # Miscellaneous options.
  47. #
  48. OPTION(INSTALL_PDB "Install .pdb file (if generated)" OFF)
  49.  
  50. # Define mod_http2 source files.
  51. #
  52. SET(mod_http2_sources
  53.     mod_http2/h2_bucket_beam.c
  54.     mod_http2/h2_bucket_eos.c
  55.     mod_http2/h2_c1.c
  56.     mod_http2/h2_c1_io.c
  57.     mod_http2/h2_c2.c
  58.     mod_http2/h2_c2_filter.c
  59.     mod_http2/h2_config.c
  60.     mod_http2/h2_conn_ctx.c
  61.     mod_http2/h2_headers.c
  62.     mod_http2/h2_mplx.c
  63.     mod_http2/h2_protocol.c
  64.     mod_http2/h2_push.c
  65.     mod_http2/h2_request.c
  66.     mod_http2/h2_session.c
  67.     mod_http2/h2_stream.c
  68.     mod_http2/h2_switch.c
  69.     mod_http2/h2_util.c
  70.     mod_http2/h2_workers.c
  71.     mod_http2/h2_ws.c
  72.     mod_http2/mod_http2.c
  73. )
  74.  
  75. # Define mod_proxy_http2 source files.
  76. #
  77. SET(mod_proxy_http2_sources
  78.     mod_http2/h2_proxy_session.c
  79.     mod_http2/h2_proxy_util.c
  80.     mod_http2/mod_proxy_http2.c
  81. )
  82.  
  83. # Define location of additional include files.
  84. #
  85. INCLUDE_DIRECTORIES(${CMAKE_INSTALL_PREFIX}/include)
  86.  
  87. # Define mod_http2 and mod_proxy_http2 libraries.
  88. #
  89. ADD_LIBRARY(mod_http2 SHARED ${mod_http2_sources})
  90. ADD_LIBRARY(mod_proxy_http2 SHARED ${mod_proxy_http2_sources})
  91.  
  92. # Generate compat_force_stdint.h header file in the build tree.
  93. #
  94. set(COMPAT_STDINT_IN "${CMAKE_BINARY_DIR}/compat_force_stdint.h")
  95. file(WRITE "${COMPAT_STDINT_IN}" "
  96.  /* compat_force_stdint.h - generated by CMake */
  97.  #ifndef COMPAT_FORCE_STDINT_H
  98.  #define COMPAT_FORCE_STDINT_H
  99.  #include <stdint.h>
  100.  #endif
  101. "
  102. )
  103.  
  104. # Add define macro for ssize_t to match pointer size.
  105. #
  106. add_definitions(-Dssize_t=intptr_t)
  107.  
  108. # For MSVC, force-include the generated header so intptr_t is known.
  109. #
  110. if(MSVC)
  111.   add_compile_options(/FI"${COMPAT_STDINT_IN}")
  112. endif()
  113.  
  114. # Define extra macros to pass to C compiler.
  115. #
  116. ADD_DEFINITIONS(
  117.   -DWITH_CURL
  118.   -DH2_NG2_STREAM_API
  119.   -DH2_NG2_CHANGE_PRIO
  120.   -DH2_NG2_INVALID_HEADER_CB
  121.   -DH2_NG2_LOCAL_WIN_SIZE
  122.   -DH2_NG2_NO_CLOSED_STREAMS
  123.   -DH2_NG2_RFC9113_STRICTNESS
  124.   -DH2_OPENSSL
  125. )
  126.  
  127. # Define mod_http2 library build properites.
  128. #
  129. SET_TARGET_PROPERTIES(mod_http2 PROPERTIES SUFFIX .so)
  130. TARGET_LINK_LIBRARIES(mod_http2
  131.   ${CMAKE_INSTALL_PREFIX}/lib/libhttpd.lib
  132.   ${apr_libraries}
  133.   ${nghttp2_libraries}
  134.   ${crypto_libraries}
  135. )
  136.  
  137. # Define mod_proxy_http2 library build properites.
  138. #
  139. SET_TARGET_PROPERTIES(mod_proxy_http2 PROPERTIES SUFFIX .so)
  140. TARGET_LINK_LIBRARIES(mod_proxy_http2
  141.   ${CMAKE_INSTALL_PREFIX}/lib/libhttpd.lib
  142.   ${apr_libraries}
  143.   ${nghttp2_libraries}
  144.   ${mod_proxy_libraries}
  145. )
  146.  
  147. # Install modules.
  148. #
  149. INSTALL(TARGETS mod_http2 RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/modules)
  150. INSTALL(TARGETS mod_proxy_http2 RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/modules)
  151.  
  152. IF(INSTALL_PDB)
  153.   INSTALL(FILES $<TARGET_PDB_FILE:mod_http2>
  154.     DESTINATION ${CMAKE_INSTALL_PREFIX}/modules
  155.     CONFIGURATIONS RelWithDebInfo Debug OPTIONAL)
  156.  
  157.   INSTALL(FILES $<TARGET_PDB_FILE:mod_proxy_http2>
  158.     DESTINATION ${CMAKE_INSTALL_PREFIX}/modules
  159.     CONFIGURATIONS RelWithDebInfo Debug OPTIONAL)
  160. ENDIF()
  161.  
Tags: cmake
Add Comment
Please, Sign In to add comment