Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do you actually link this to your own project? #44

Closed
cowratt opened this issue Feb 1, 2021 · 1 comment
Closed

How do you actually link this to your own project? #44

cowratt opened this issue Feb 1, 2021 · 1 comment

Comments

@cowratt
Copy link

cowratt commented Feb 1, 2021

Hi,
This seems like a trivially simple question, but I haven't been able to find a solution for this anywhere. I have my own project that uses Gnu Make and I want to use a few of the modules from this package.

For example, assume that I copy the Asio service example from the README into a new file outside of the CppServer project:

#include "server/asio/service.h"
#include "threads/thread.h"

#include <iostream>

int main(int argc, char** argv)
{
    ...

What are the steps to actually link and build this? I managed to convert things to GMake using cmake -G "Unix Makefiles", but these files have no concept of or reference to the source files. It seems like the CppServer project is only built around creating its own internal example files. Any help is greatly appreciated.

Thank you

@chronoxor
Copy link
Owner

chronoxor commented Feb 2, 2021

We usually have CppServer.cmake file for the module:

if(NOT TARGET cppserver)

  # Module flag
  set(CPPSERVER_MODULE Y)

  # Module subdirectory
  add_subdirectory("CppServer")

  # Module folder
  set_target_properties(cppserver PROPERTIES FOLDER "modules/CppServer")

endif()

And then just include("CppServer.cmake") into your CMakeLists.txt. After this you can just link your library or executable over cppserver lib.

@cowratt cowratt closed this as completed Feb 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants