Skip to content

build: add llhttp-specific prefix to CMake options. #657

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

tom-seddon
Copy link

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 #647

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 nodejs#647
@tom-seddon
Copy link
Author

tom-seddon commented Apr 23, 2025

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.

@ShogunPanda
Copy link
Contributor

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.

@Uzlopak
Copy link
Contributor

Uzlopak commented Jun 1, 2025

modified the docs

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

Successfully merging this pull request may close these issues.

3 participants