-
Notifications
You must be signed in to change notification settings - Fork 4
/
CMakeLists.txt
44 lines (32 loc) · 1.41 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
cmake_minimum_required(VERSION 3.10)
project(gmod-chttp LANGUAGES CXX)
set(CHTTP_VERSION "dev" CACHE STRING "The user-visible CHTTP version")
set(CHTTP_BUILD_TARGET "unset" CACHE STRING "")
set(CHTTP_BUILD_TYPE "unset" CACHE STRING "")
set(CHTTP_BUILD_STATIC "unset" CACHE STRING "")
set(CMAKE_CONFIGURATION_TYPES Release Debug)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Use curl builds that only have HTTP
set(CURL_HTTPONLY ON)
add_subdirectory(gmod-module-base/include)
add_subdirectory(curl-static-bin)
add_library(chttp SHARED)
# Add sources
add_subdirectory(src)
# Link against the GMod API
target_link_libraries(chttp gmod-module-base)
# Link against curl
target_link_libraries(chttp curl-phony)
# Set linker script for Linux
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
target_link_options(chttp PRIVATE "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/chttp-linux.exp")
endif()
target_compile_definitions(chttp PRIVATE "CHTTP_VERSION=\"${CHTTP_VERSION}\"")
target_compile_definitions(chttp PRIVATE "CHTTP_BUILD_TARGET=\"${CHTTP_BUILD_TARGET}\"")
target_compile_definitions(chttp PRIVATE "CHTTP_BUILD_TYPE=\"${CHTTP_BUILD_TYPE}\"")
target_compile_definitions(chttp PRIVATE "CHTTP_BUILD_STATIC=\"${CHTTP_BUILD_STATIC}\"")
set_gmod_suffix_prefix(chttp)
if("${MORE_STATIC_LINKS}" AND ${CMAKE_SYSTEM_NAME} MATCHES "Linux")
target_link_options(chttp PRIVATE "-static-libstdc++" "-static-libgcc")
endif()