zaphoyd / websocketpp

C++ websocket client/server library
http://www.zaphoyd.com/websocketpp
Other
7.05k stars 1.98k forks source link

Remove dependency from Boost for Asio standalone #1099

Open pedro-vicente opened 1 year ago

pedro-vicente commented 1 year ago

I was experimenting to build a basic example with a client and a server using Asio standalone, but the CMake script forces the use of Boost for the examples

option (BUILD_EXAMPLES "Build websocketpp examples." TRUE)

giving error

Could NOT find Boost (missing: Boost_INCLUDE_DIR) (Required is at least version "1.39.0")
CMakeLists.txt:218 (find_package)

So, I built a simple script to do just that

cmake_minimum_required (VERSION 3.24)
project (websocketpp)

include_directories(${CMAKE_SOURCE_DIR})
include_directories(${CMAKE_SOURCE_DIR}/../asio-1.18.1/include)

add_definitions(-DASIO_STANDALONE)

add_definitions(-D_WEBSOCKETPP_CPP11_RANDOM_DEVICE_)
add_definitions(-D_WEBSOCKETPP_CPP11_TYPE_TRAITS_)

add_executable (echo_client examples/echo_client/echo_client.cpp)
add_executable (echo_server examples/echo_server/echo_server.cpp)

It should be fairly easy to add a few if/elses on the current CMakeLists.txt to avoid the error, but I just wanted to leave this here for now

Obsidian200 commented 1 year ago

Thank you very much. I have no understanding of CMake, which part of CMakeLists should I replace?