From: Viktor Szakats Date: Tue, 6 Aug 2024 00:59:54 +0000 (+0200) Subject: cmake: limit libidn2 `pkg-config` detection to `UNIX` X-Git-Tag: curl-8_10_0~308 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=515440a2f29e720e09b4942f8a9106418f728410;p=thirdparty%2Fcurl.git cmake: limit libidn2 `pkg-config` detection to `UNIX` 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 --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 6e6c40dd66..f0c744dd8a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -959,8 +959,10 @@ if(USE_LIBIDN2) 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)