Closed kusosuha6vt closed 3 months ago
Which version are you trying?
This is the case at least for 1.0.0. At the commit tagged for that release on branch v1.x
, the repository for example doesn't have the sockpp/version.h
header file, which the examples include.
Edit:
I'm wrong. Actually, that header is generated and the examples do compile. It seems the problem (for me) is that using sockpp through FetchContent doesn't result in build/generated/include
being added to the PUBLIC
include directories of the sockpp target. What is the reasoning behind it being added as PRIVATE
in CMakeLists.txt anyway?
On that note, is it even a good idea to use FetchContent? What would be the preferred way to use sockpp from a CMake project?
I'm not a CMake power user. I'm just figuring it out a little as I go along. I've never heard of FetchContent.
The two common ways to use a library like this from your own CMake project:
add_subdirectory()
.My initial assumption was 1, and that is basically what is documented in the README. Download the sources, go to the top-level source directory and enter:
$ cmake --build build/ --target install
That installs the built library onto your system. Then in your CMake,
find_package(sockpp REQUIRED)
...
target_link_libraries(myapp Sockpp::sockpp)
At some point I can verify that 2 works and add instructions for that.
Closing this as we have gone off-topic from the original issue. Please re-open if there is a specific repo branch or release version which has a broken build for the examples.
For example,
sockpp/examples/tcp/tcpecho.cpp
doesn't compile, becausetcp_connector
expectsaddr_t
instead of address and port. And documentation doesn't say how to construct anaddr_t