llhttp icon indicating copy to clipboard operation
llhttp copied to clipboard

build: add llhttp-specific prefix to CMake options.

Open tom-seddon opened this issue 8 months ago • 3 comments

BUILD_SHARED_LIBS is now called LLHTTP_BUILD_SHARED_LIBS.

BUILD_STATIC_LIBS is now called LLHTTP_BUILD_STATIC_LIBS.

CMake options have global scope so there's the risk of conflict otherwise. For example, libcurl has a BUILD_STATIC_LIBS option too.

Documentation updates to be discussed.

See https://github.com/nodejs/llhttp/issues/647

tom-seddon avatar Apr 23 '25 18:04 tom-seddon

I've left the docs as-is, but they'll need updating too. I was thinking of updating the example so that it uses the newer option names and fetches the suitable newest version - but I wasn't sure which version number to put in! And add a note about the older option names.

So something like this. How does this look?


If you want to use this library in a CMake project as a static library, you can set some cache variables first.

FetchContent_Declare(llhttp
  URL "https://github.com/nodejs/llhttp/archive/refs/tags/release/v9.x.y.tar.gz")

set(LLHTTP_BUILD_SHARED_LIBS OFF CACHE INTERNAL "")
set(LLHTTP_BUILD_STATIC_LIBS ON CACHE INTERNAL "")
FetchContent_MakeAvailable(llhttp)

# Link with the llhttp_static target
target_link_libraries(${EXAMPLE_PROJECT_NAME} ${PROJECT_LIBRARIES} llhttp_static ${PROJECT_NAME})

If using a version prior to 9.x.y, the LLHTTP_BUILD_SHARED_LIBS and LLHTTP_BUILD_STATIC_LIBS options are known as BUILD_SHARED_LIBS and BUILD_STATIC_LIBS respectively.

tom-seddon avatar Apr 23 '25 19:04 tom-seddon

Thanks for the PR! I would say put the latest 9.x.y version, but eventually put a comment that says that prior to version 9.2.1 included the variables should not use the LLHTTP_ prefix.

ShogunPanda avatar Apr 25 '25 07:04 ShogunPanda

modified the docs

Uzlopak avatar Jun 01 '25 08:06 Uzlopak