File: civetweb-3rdparty-config.cmake

package info (click to toggle)
prometheus-cpp 1.0.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 792 kB
  • sloc: cpp: 3,596; sh: 37; makefile: 12
file content (73 lines) | stat: -rw-r--r-- 1,881 bytes parent folder | download | duplicates (3)
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
get_filename_component(_IMPORT_PREFIX "${PROJECT_SOURCE_DIR}/3rdparty/civetweb/" ABSOLUTE)

macro(set_and_check _var _file)
  set(${_var} "${_file}")
  if(NOT EXISTS "${_file}")
    message(FATAL_ERROR "File or directory ${_file} referenced by variable ${_var} does not exist !")
  endif()
endmacro()

set_and_check(CIVETWEB_INCLUDE_DIR ${_IMPORT_PREFIX}/include)
set(CIVETWEB_INCLUDE_DIRS "${CIVETWEB_INCLUDE_DIR}")

add_library(civetweb OBJECT
  ${_IMPORT_PREFIX}/include/CivetServer.h
  ${_IMPORT_PREFIX}/include/civetweb.h
  ${_IMPORT_PREFIX}/src/CivetServer.cpp
  ${_IMPORT_PREFIX}/src/civetweb.c
  ${_IMPORT_PREFIX}/src/handle_form.inl
  ${_IMPORT_PREFIX}/src/md5.inl
)

set_property(TARGET civetweb PROPERTY PUBLIC_HEADER
  ${_IMPORT_PREFIX}/include/CivetServer.h
  ${_IMPORT_PREFIX}/include/civetweb.h
)

target_compile_definitions(civetweb
  PRIVATE
    CIVETWEB_API=
    USE_IPV6
    NDEBUG
    NO_CGI
    NO_CACHING
    NO_FILES
    SOCKET_TIMEOUT_QUANTUM=200
)

target_compile_options(civetweb
  PRIVATE
    $<$<CXX_COMPILER_ID:AppleClang>:-w>
    $<$<CXX_COMPILER_ID:GNU>:-w>
)

target_include_directories(civetweb
  PRIVATE
    ${CIVETWEB_INCLUDE_DIRS}
)

if(THIRDPARTY_CIVETWEB_WITH_SSL)
  include(CMakeFindDependencyMacro)
  find_dependency(OpenSSL)
  if(OPENSSL_VERSION VERSION_GREATER_EQUAL 1.1)
    target_compile_definitions(civetweb PRIVATE OPENSSL_API_1_1)
  endif()
  target_compile_definitions(civetweb PRIVATE NO_SSL_DL)
  target_link_libraries(civetweb PUBLIC OpenSSL::SSL)
else()
  target_compile_definitions(civetweb PRIVATE NO_SSL)
endif()

if(BUILD_SHARED_LIBS)
  set_target_properties(civetweb PROPERTIES
    POSITION_INDEPENDENT_CODE ON
    C_VISIBILITY_PRESET hidden
    CXX_VISIBILITY_PRESET hidden
    VISIBILITY_INLINES_HIDDEN ON
  )
endif()

set_target_properties(civetweb PROPERTIES
  C_INCLUDE_WHAT_YOU_USE ""
  CXX_INCLUDE_WHAT_YOU_USE ""
)