Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # CMakeLists.txt file for MOD_HTTP2 - 2026-05-26
- #
- CMAKE_MINIMUM_REQUIRED(VERSION 3.15)
- PROJECT(mod_http2 C)
- IF(NOT EXISTS ${CMAKE_INSTALL_PREFIX}/lib/libhttpd.lib)
- MESSAGE(FATAL_ERROR "libhttpd.lib was not found in prefix ${CMAKE_INSTALL_PREFIX}")
- ENDIF()
- # Select APR trunk (libapr-2.lib) if it exists in PREFIX/lib; otherwise, select
- # APR 1.x + APR-util 1.x
- #
- IF(EXISTS "${CMAKE_INSTALL_PREFIX}/lib/libapr-2.lib")
- SET(apr_libraries
- ${CMAKE_INSTALL_PREFIX}/lib/libapr-2.lib)
- ELSEIF(EXISTS "${CMAKE_INSTALL_PREFIX}/lib/libapr-1.lib")
- SET(apr_libraries
- ${CMAKE_INSTALL_PREFIX}/lib/libapr-1.lib
- ${CMAKE_INSTALL_PREFIX}/lib/libaprutil-1.lib)
- ELSE()
- MESSAGE(FATAL_ERROR "APR libraries were not found in prefix ${CMAKE_INSTALL_PREFIX}")
- ENDIF()
- IF(EXISTS ${CMAKE_INSTALL_PREFIX}/lib/libcrypto.lib)
- SET(crypto_libraries
- ${CMAKE_INSTALL_PREFIX}/lib/libcrypto.lib)
- ELSE()
- MESSAGE(FATAL_ERROR "libcrypto.lib was not found in prefix ${CMAKE_INSTALL_PREFIX}")
- ENDIF()
- IF(EXISTS ${CMAKE_INSTALL_PREFIX}/lib/mod_proxy.lib)
- SET(mod_proxy_libraries
- ${CMAKE_INSTALL_PREFIX}/lib/mod_proxy.lib)
- ELSE()
- MESSAGE(FATAL_ERROR "mod_proxy.lib was not found in prefix ${CMAKE_INSTALL_PREFIX}")
- ENDIF()
- IF(EXISTS ${CMAKE_INSTALL_PREFIX}/lib/nghttp2.lib)
- SET(nghttp2_libraries
- ${CMAKE_INSTALL_PREFIX}/lib/nghttp2.lib)
- ELSE()
- MESSAGE(FATAL_ERROR "nghttp2.lib was not found in prefix ${CMAKE_INSTALL_PREFIX}")
- ENDIF()
- # Miscellaneous options.
- #
- OPTION(INSTALL_PDB "Install .pdb file (if generated)" OFF)
- # Define mod_http2 source files.
- #
- SET(mod_http2_sources
- mod_http2/h2_bucket_beam.c
- mod_http2/h2_bucket_eos.c
- mod_http2/h2_c1.c
- mod_http2/h2_c1_io.c
- mod_http2/h2_c2.c
- mod_http2/h2_c2_filter.c
- mod_http2/h2_config.c
- mod_http2/h2_conn_ctx.c
- mod_http2/h2_headers.c
- mod_http2/h2_mplx.c
- mod_http2/h2_protocol.c
- mod_http2/h2_push.c
- mod_http2/h2_request.c
- mod_http2/h2_session.c
- mod_http2/h2_stream.c
- mod_http2/h2_switch.c
- mod_http2/h2_util.c
- mod_http2/h2_workers.c
- mod_http2/h2_ws.c
- mod_http2/mod_http2.c
- )
- # Define mod_proxy_http2 source files.
- #
- SET(mod_proxy_http2_sources
- mod_http2/h2_proxy_session.c
- mod_http2/h2_proxy_util.c
- mod_http2/mod_proxy_http2.c
- )
- # Define location of additional include files.
- #
- INCLUDE_DIRECTORIES(${CMAKE_INSTALL_PREFIX}/include)
- # Define mod_http2 and mod_proxy_http2 libraries.
- #
- ADD_LIBRARY(mod_http2 SHARED ${mod_http2_sources})
- ADD_LIBRARY(mod_proxy_http2 SHARED ${mod_proxy_http2_sources})
- # Generate compat_force_stdint.h header file in the build tree.
- #
- set(COMPAT_STDINT_IN "${CMAKE_BINARY_DIR}/compat_force_stdint.h")
- file(WRITE "${COMPAT_STDINT_IN}" "
- /* compat_force_stdint.h - generated by CMake */
- #ifndef COMPAT_FORCE_STDINT_H
- #define COMPAT_FORCE_STDINT_H
- #include <stdint.h>
- #endif
- "
- )
- # Add define macro for ssize_t to match pointer size.
- #
- add_definitions(-Dssize_t=intptr_t)
- # For MSVC, force-include the generated header so intptr_t is known.
- #
- if(MSVC)
- add_compile_options(/FI"${COMPAT_STDINT_IN}")
- endif()
- # Define extra macros to pass to C compiler.
- #
- ADD_DEFINITIONS(
- -DWITH_CURL
- -DH2_NG2_STREAM_API
- -DH2_NG2_CHANGE_PRIO
- -DH2_NG2_INVALID_HEADER_CB
- -DH2_NG2_LOCAL_WIN_SIZE
- -DH2_NG2_NO_CLOSED_STREAMS
- -DH2_NG2_RFC9113_STRICTNESS
- -DH2_OPENSSL
- )
- # Define mod_http2 library build properites.
- #
- SET_TARGET_PROPERTIES(mod_http2 PROPERTIES SUFFIX .so)
- TARGET_LINK_LIBRARIES(mod_http2
- ${CMAKE_INSTALL_PREFIX}/lib/libhttpd.lib
- ${apr_libraries}
- ${nghttp2_libraries}
- ${crypto_libraries}
- )
- # Define mod_proxy_http2 library build properites.
- #
- SET_TARGET_PROPERTIES(mod_proxy_http2 PROPERTIES SUFFIX .so)
- TARGET_LINK_LIBRARIES(mod_proxy_http2
- ${CMAKE_INSTALL_PREFIX}/lib/libhttpd.lib
- ${apr_libraries}
- ${nghttp2_libraries}
- ${mod_proxy_libraries}
- )
- # Install modules.
- #
- INSTALL(TARGETS mod_http2 RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/modules)
- INSTALL(TARGETS mod_proxy_http2 RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/modules)
- IF(INSTALL_PDB)
- INSTALL(FILES $<TARGET_PDB_FILE:mod_http2>
- DESTINATION ${CMAKE_INSTALL_PREFIX}/modules
- CONFIGURATIONS RelWithDebInfo Debug OPTIONAL)
- INSTALL(FILES $<TARGET_PDB_FILE:mod_proxy_http2>
- DESTINATION ${CMAKE_INSTALL_PREFIX}/modules
- CONFIGURATIONS RelWithDebInfo Debug OPTIONAL)
- ENDIF()
Add Comment
Please, Sign In to add comment