CppServer icon indicating copy to clipboard operation
CppServer copied to clipboard

linux install

Open lrryhss opened this issue 5 years ago • 2 comments

How can I install CppServer on a system. So it can be used with my own cmake project. I tried using cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=/usr/local ..

and when I do make install it only copies the binary's to CppServer/bin

it looks like the CMakelists.txt file doesn't have install targets for the headers and lib.

lrryhss avatar Jun 19 '20 18:06 lrryhss

I use this CppServer.cmake file to include CppServer project:

if(NOT TARGET cppserver)

  # Module flag
  set(CPPSERVER_MODULE Y)

  # Module subdirectory
  add_subdirectory("CppServer")

  # Module folder
  set_target_properties(cppserver PROPERTIES FOLDER CppServer)

endif()

It will give you a cppserver static lib target which you can use in your own CMakeLists.txt:

include("CppServer.cmake")
...
target_link_libraries(your-project cppserver)

chronoxor avatar Jun 19 '20 22:06 chronoxor

What is the g++ compiler command equivalent?

I copied the include files to /usr/local/include and the libcppserver.a to /usr/local/lib but get a

In file included from /usr/local/include/server/asio/udp_resolver.h:12:0,
                from /usr/local/include/server/asio/udp_client.h:12,
                from udp-client.cpp:3:
/usr/local/include/server/asio/service.h:15:10: fatal error: threads/thread.h: No such file or di
rectory                                                                                         
#include "threads/thread.h"
         ^~~~~~~~~~~~~~~~~~
compilation terminated.

if I try to compile using g++ -std=c++11 udp-client.cpp -lpthread, I get a threads/threads.h not found.

Found them at CppCommon.

But, not quite; how do I compile udp-client.cpp by putting it outside the directory? I get plenty of error messages, one being

udp-client.cpp:114:17: error: ‘using element_type = class EchoClient {aka class EchoClient}’ has no
 member named ‘SendSync’; did you mean ‘SendAsync’?
         client->SendSync(line);
                 ^~~~~~~~
                 SendAsync

digikar99 avatar Aug 05 '20 14:08 digikar99