libidn2 is detected by default, which triggers a `pkg-config` detectio
attempt by default. This in turn may pick up libidn2 inadvertently from
the disk, and append the libidn2 header directory to the include path.
This header directory might contain incompatible system and/or component
headers, causing confusion and failed builds.
Some of these side-effects may be the result of an unknowningly
configured (or misconfigured) `pkg-config`. In another reported case,
it was hit by the `pkg-config` from Strawberry Perl. Until we
investigate the reasons and come up with a technique to avoid these
issues, limit `pkg-config` detection to UNIX platforms, like we already
do in `Find*` modules.
Notice that `-DCURL_USE_LIBSSH=ON`, `-DCURL_USE_GSASL=ON`, and
`-DCURL_USE_LIBUV=ON` options continue to have the above side-effects,
though these options are disabled by default.
Follow-up to
f43adc2c4978f7f82a359e89186e58a31d17b0ad #14137
Reported-by: Micah Snyder
Fixes #14405
Closes #14408
check_include_file_concat("idn2.h" HAVE_IDN2_H)
endif()
if(NOT HAVE_LIBIDN2 OR NOT HAVE_IDN2_H)
- find_package(PkgConfig QUIET)
- pkg_search_module(LIBIDN2 "libidn2")
+ if(UNIX)
+ find_package(PkgConfig QUIET)
+ pkg_search_module(LIBIDN2 "libidn2")
+ endif()
if(LIBIDN2_FOUND)
include_directories(${LIBIDN2_INCLUDE_DIRS})
set(HAVE_LIBIDN2 ON)