Skip to content

Do I need to manually add source files like net/http/*.cpp to my CMakeLists.txt when using Photon? #804

@TrKNguyen

Description

@TrKNguyen

Hi, I'm trying to use Photon’s HTTP client in my project and I noticed that to use classes like photon::net::http::Client, I had to not only #include the header in my .cpp file, but also explicitly add the corresponding .cpp files from photon-src/net/http/ to my CMakeLists.txt, like this:

////

add_executable(client_https
client_https.cpp
${CMAKE_BINARY_DIR}/_deps/photon-src/net/http/client.cpp
${CMAKE_BINARY_DIR}/_deps/photon-src/net/http/headers.cpp
${CMAKE_BINARY_DIR}/_deps/photon-src/net/http/message.cpp
${CMAKE_BINARY_DIR}/_deps/photon-src/net/http/body.cpp
${CMAKE_BINARY_DIR}/_deps/photon-src/net/http/url.cpp
${CMAKE_BINARY_DIR}/_deps/photon-src/common/estring.cpp
)

////

Normally, I expect that after linking the Photon library via CMake and including the right headers, the implementation should already be compiled and linked. Like normally, when I want to use any file in /common, /io, /thread I just need to include the right headers. But in this case, I need to manually include the .cpp files from net/http.

👉 My questions:

Is this expected behavior for the HTTP client and related modules in Photon?

Are the net/http/*.cpp files intentionally not built into the main Photon static/shared library?

If I use other submodules like net/rsocket, will I also need to manually include their .cpp files?

I'm just trying to understand the intended integration model, whether those are optional utilities or meant to be built into the core Photon lib.

Thank you so much for your help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions