seasocks icon indicating copy to clipboard operation
seasocks copied to clipboard

Documentation for client code usage

Open offa opened this issue 6 years ago • 1 comments

There's no good documentation around, how this library is integrated in client projects (#119).

offa avatar Apr 10 '19 16:04 offa

Was about to file a PR and I saw this issue and related #119. Just quickly chiming in, since this is really simple since my contributions in PR's #116, #108 and #110 .

In the most minimal form, a direct copy paste from the description of #116. This should work after an install (make install) of seasocks has been performed:

cmake_minimum_required(VERSION 3.3)
find_package(Seasocks 1.4.0) # Requires at least version 1.4.0.
add_executable(my_server serve.cpp)
target_link_libraries(my_server Seasocks::seasocks)

Seasocks can also be used as a submodule inside the directory structure of the host cmake project. In that case let's assume seasocks is located in the thirdparty folder.

Doing something like:

if(USE_EXTERNAL_SEASOCKS)
  find_package(Seasocks REQUIRED)
else()
  set(UNITTESTS OFF CACHE INTERNAL "")
  set(SEASOCKS_EXAMPLE_APP OFF CACHE INTERNAL "")
  add_subdirectory(thirdparty/seasocks)
endif()

After those lines you can just link your binary / library against the now exported Seasocks::seasocks target with the target_link_libraries(my_server Seasocks::seasocks) instruction.

iwanders avatar Oct 05 '19 18:10 iwanders