Added a feature test to auto enable/disable CPPHTTPLIB_USE_NON_BLOCKI… - #2578
Open
TobiasWallner wants to merge 1 commit into
Open
Added a feature test to auto enable/disable CPPHTTPLIB_USE_NON_BLOCKI…#2578TobiasWallner wants to merge 1 commit into
TobiasWallner wants to merge 1 commit into
Conversation
Owner
|
@sum01 @jimmy-park @Tachi107 this PR looks good to me. Could you please take a look at it? |
Owner
|
@TobiasWallner could you take a look at the CI failures of |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add CMake feature detection for
CPPHTTPLIB_USE_NON_BLOCKING_GETADDRINFOon Windows.When
HTTPLIB_USE_NON_BLOCKING_GETADDRINFOis enabled, CMake now checks whetherGetAddrInfoExCancelis available before exportingCPPHTTPLIB_USE_NON_BLOCKING_GETADDRINFOthrough thehttplib::httplibtarget. If the symbol is not available, the non-blocking getaddrinfo support is disabled automatically.Motivation
Some Windows machines/toolchains do not provide
GetAddrInfoExCancel, which causes downstream projects using cpp-httplib via CMake to fail compilation whenCPPHTTPLIB_USE_NON_BLOCKING_GETADDRINFOis exported unconditionally.Previously, consumers had to work around this by manually removing the interface compile definition from
httplib::httplib. With this change, cpp-httplib configures itself correctly out of the box.Testing
Verified on a Windows machine where
GetAddrInfoExCancelis unavailable:GetAddrInfoExCancel - not foundHTTPLIB_IS_USING_NON_BLOCKING_GETADDRINFOis set toFALSECPPHTTPLIB_USE_NON_BLOCKING_GETADDRINFOis not present on the consumer compile line