websocketpp icon indicating copy to clipboard operation
websocketpp copied to clipboard

Remove dependency from Boost for Asio standalone

Open pedro-vicente opened this issue 1 year ago • 1 comments

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

pedro-vicente avatar May 17 '23 03:05 pedro-vicente

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

Obsidian200 avatar Jun 25 '23 06:06 Obsidian200