CppServer
CppServer copied to clipboard
linux install
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.
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)
What is the g++ compiler command equivalent?
I copied the include files to
/usr/local/includeand thelibcppserver.ato/usr/local/libbut get aIn 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 athreads/threads.hnot 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