Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #CMakeLists.txt
- cmake_minimum_required(VERSION 3.28)
- project(entitywind_uwebsockets_test LANGUAGES C CXX)
- include(FetchContent)
- set(CMAKE_CXX_STANDARD 23)
- find_package(OpenSSL REQUIRED)
- if( OPENSSL_FOUND )
- include_directories(${OPENSSL_INCLUDE_DIRS})
- message(STATUS "Using OpenSSL ${OPENSSL_VERSION}")
- else()
- # Error; with REQUIRED, pkg_search_module() will throw an error by it's own
- endif()
- FetchContent_Declare(
- uSockets_content
- GIT_REPOSITORY https://github.com/uNetworking/uSockets
- GIT_TAG v0.8.8
- GIT_SHALLOW ON
- GIT_SUBMODULES ""
- )
- FetchContent_MakeAvailable(uSockets_content)
- file(GLOB_RECURSE USOCKETS_SOURCES ${usockets_content_SOURCE_DIR}/src/*.c)
- add_library(uSockets SHARED ${USOCKETS_SOURCES})
- target_include_directories(uSockets PUBLIC ${usockets_content_SOURCE_DIR}/src ${ZLIB_INCLUDE_DIRS} )
- target_compile_definitions(uSockets INTERFACE LIBUS_USE_OPENSSL)
- target_link_libraries(uSockets ${ZLIB_LIBRARIES} ssl crypto)
- FetchContent_Declare(
- uWebSockets_content
- GIT_REPOSITORY https://github.com/uNetworking/uWebSockets
- GIT_TAG v20.70.0
- GIT_SHALLOW ON
- GIT_SUBMODULES ""
- )
- FetchContent_MakeAvailable(uWebSockets_content)
- find_package(ZLIB REQUIRED)
- add_library(uWebSockets INTERFACE)
- target_include_directories(uWebSockets INTERFACE ${uwebsockets_content_SOURCE_DIR}/src/)
- target_link_libraries(uWebSockets INTERFACE uSockets ${ZLIB_LIBRARIES} OpenSSL::SSL OpenSSL::Crypto)
- target_compile_options(uWebSockets INTERFACE -Wno-deprecated-declarations)
- # Client exec
- add_executable(client client_ws.cc)
- target_link_libraries(client uWebSockets)
- # Server exec
- add_executable(server server_ws.cc)
- target_link_libraries(server uWebSockets OpenSSL::SSL OpenSSL::Crypto)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement