Files
cpp-project-template/third_party/prometheus/cmake/civetweb-3rdparty-config.cmake
tqcq c68893bace
Some checks failed
sm-rpc / build (Debug, aarch64-linux-gnu) (push) Failing after 29s
sm-rpc / build (Debug, arm-linux-gnueabihf) (push) Failing after 16s
sm-rpc / build (Debug, host.gcc) (push) Failing after 11s
sm-rpc / build (Debug, mipsel-linux-gnu) (push) Failing after 12s
sm-rpc / build (Release, aarch64-linux-gnu) (push) Failing after 11s
sm-rpc / build (Release, arm-linux-gnueabihf) (push) Failing after 11s
sm-rpc / build (Release, host.gcc) (push) Failing after 12s
sm-rpc / build (Release, mipsel-linux-gnu) (push) Failing after 16s
feat add spdlog
2025-08-22 18:22:57 +08:00

74 lines
1.8 KiB
CMake

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 ""
)