| 1 |
cmake_minimum_required(VERSION 3.9...3.31) |
| 2 |
project(aws-c-http C) |
| 3 |
|
| 4 |
option(ENABLE_PROXY_INTEGRATION_TESTS "Whether to run the proxy integration tests that rely on pre-configured proxy" OFF) |
| 5 |
option(ENABLE_LOCALHOST_INTEGRATION_TESTS "Whether to run the integration tests that rely on pre-configured localhost" OFF) |
| 6 |
|
| 7 |
if (NOT IN_SOURCE_BUILD) |
| 8 |
# this is required so we can use aws-c-common's CMake modules |
| 9 |
find_package(aws-c-common REQUIRED) |
| 10 |
endif() |
| 11 |
|
| 12 |
include(AwsCFlags) |
| 13 |
include(AwsCheckHeaders) |
| 14 |
include(AwsSharedLibSetup) |
| 15 |
include(AwsSanitizers) |
| 16 |
include(CheckCCompilerFlag) |
| 17 |
include(AwsFindPackage) |
| 18 |
include(GNUInstallDirs) |
| 19 |
|
| 20 |
file(GLOB AWS_HTTP_HEADERS |
| 21 |
"include/aws/http/*.h" |
| 22 |
) |
| 23 |
|
| 24 |
file(GLOB AWS_HTTP_PRIV_HEADERS |
| 25 |
"include/aws/http/private/*.h" |
| 26 |
) |
| 27 |
|
| 28 |
file(GLOB AWS_HTTP_SRC |
| 29 |
"source/*.c" |
| 30 |
) |
| 31 |
|
| 32 |
file(GLOB HTTP_HEADERS |
| 33 |
${AWS_HTTP_HEADERS} |
| 34 |
${AWS_HTTP_PRIV_HEADERS} |
| 35 |
) |
| 36 |
|
| 37 |
file(GLOB HTTP_SRC |
| 38 |
${AWS_HTTP_SRC} |
| 39 |
) |
| 40 |
|
| 41 |
add_library(${PROJECT_NAME} ${HTTP_HEADERS} ${HTTP_SRC}) |
| 42 |
aws_set_common_properties(${PROJECT_NAME}) |
| 43 |
aws_prepare_symbol_visibility_args(${PROJECT_NAME} "AWS_HTTP") |
| 44 |
aws_add_sanitizers(${PROJECT_NAME}) |
| 45 |
|
| 46 |
# We are not ABI stable yet |
| 47 |
set_target_properties(${PROJECT_NAME} PROPERTIES VERSION 1.0.0) |
| 48 |
|
| 49 |
target_include_directories(${PROJECT_NAME} PUBLIC |
| 50 |
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> |
| 51 |
$<INSTALL_INTERFACE:include>) |
| 52 |
|
| 53 |
aws_use_package(aws-c-io) |
| 54 |
aws_use_package(aws-c-compression) |
| 55 |
target_link_libraries(${PROJECT_NAME} PUBLIC ${DEP_AWS_LIBS}) |
| 56 |
|
| 57 |
aws_prepare_shared_lib_exports(${PROJECT_NAME}) |
| 58 |
|
| 59 |
aws_check_headers(${PROJECT_NAME} ${AWS_HTTP_HEADERS}) |
| 60 |
install(FILES ${AWS_HTTP_HEADERS} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/aws/http") |
| 61 |
|
| 62 |
if (BUILD_SHARED_LIBS) |
| 63 |
set (TARGET_DIR "shared") |
| 64 |
else() |
| 65 |
set (TARGET_DIR "static") |
| 66 |
endif() |
| 67 |
|
| 68 |
install(EXPORT "${PROJECT_NAME}-targets" |
| 69 |
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}/${TARGET_DIR}/" |
| 70 |
NAMESPACE AWS:: |
| 71 |
COMPONENT Development) |
| 72 |
|
| 73 |
configure_file("cmake/${PROJECT_NAME}-config.cmake" |
| 74 |
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake" |
| 75 |
@ONLY) |
| 76 |
|
| 77 |
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake" |
| 78 |
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}/" |
| 79 |
COMPONENT Development) |
| 80 |
|
| 81 |
include(CTest) |
| 82 |
if (NOT BYO_CRYPTO AND BUILD_TESTING) |
| 83 |
add_subdirectory(tests) |
| 84 |
if (NOT CMAKE_CROSSCOMPILING) |
| 85 |
add_subdirectory(bin/elasticurl) |
| 86 |
add_subdirectory(bin/h2benchmark) |
| 87 |
endif() |
| 88 |
endif() |