Skip to content

[Feature]: CMake package and FetchContent installation support #46

Description

@noneandundefined

Problem / use case

libchttpx currently provides Makefile builds, pkg-config metadata, native Linux packages, installer scripts, and Docker images. C/C++ projects that use CMake still need custom include/library discovery or shell installation steps.

Providing a first-class CMake package would make the library easier to consume as both an installed dependency and a source dependency, especially in cross-platform projects and CI.

Proposed solution

Add a maintained CMakeLists.txt and exported CMake package target.

Desired consumer experience after system installation:

find_package(libchttpx CONFIG REQUIRED)
target_link_libraries(my_server PRIVATE libchttpx::libchttpx)

And optionally directly from source:

include(FetchContent)
FetchContent_Declare(libchttpx GIT_REPOSITORY https://github.com/netcorelink/libchttpx.git GIT_TAG vX.Y.Z)
FetchContent_MakeAvailable(libchttpx)
target_link_libraries(my_server PRIVATE libchttpx::libchttpx)

Acceptance criteria

  • CMake can build the shared library on supported Linux and Windows configurations.
  • cmake --install installs headers, library, and libchttpxConfig.cmake/version metadata.
  • Installed package exports libchttpx::libchttpx.
  • cJSON and platform dependencies are propagated correctly to consumers.
  • FetchContent/add_subdirectory use does not modify global compiler settings unnecessarily.
  • Existing Makefile and pkg-config workflows continue to work.
  • CI builds a small consumer project using both find_package and FetchContent.
  • Native packages include the CMake config files.
  • EN/RU installation documentation includes CMake examples.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions