mirror of
https://github.com/curl/curl.git
synced 2024-11-27 05:50:21 +08:00
93e6e4b823
Fix builds with CMake configured to falsely return successful detection when using `check_function_exists()` (and `check_library_exists()`, and anything based on `try_compile()` that's relying on the linker). After such mis-detection the build fails when trying to use the feature that doesn't in fact exist. The mis-detection is caused by this CMake setting: ``` set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) ``` It is set by default (or on conditions) when using 3rd-party toolchain: https://github.com/leetal/ios-cmake/blob/master/ios.toolchain.cmake After this patch the curl build overrides this setting for the duration of feature tests, and logs a message about it. Also preset and skip feature tests for known mis-detections: - `connect()` in `libsocket` - `getpass_r()` - `eventfd()` (did not cause an issue due to a separate bug) - `sendmmsg()` (did not cause an issue because it's Linux-only) If mis-detections are still seen, the workaround is to force-set the specific feature by passing `-DHAVE_*=OFF` to cmake. Also consider passing `-DENABLE_STRICT_TRY_COMPILE=ON` for `ios.toolchain.cmake` to fix the root cause. Interestingly curl itself uses this setting to speed up compile-only detections: |
||
---|---|---|
.. | ||
Platforms | ||
cmake_uninstall.cmake.in | ||
CMakeConfigurableFile.in | ||
curl-config.cmake.in | ||
CurlSymbolHiding.cmake | ||
CurlTests.c | ||
FindBearSSL.cmake | ||
FindBrotli.cmake | ||
FindCares.cmake | ||
FindGSS.cmake | ||
FindLibgsasl.cmake | ||
FindLibidn2.cmake | ||
FindLibpsl.cmake | ||
FindLibssh2.cmake | ||
FindLibssh.cmake | ||
FindLibuv.cmake | ||
FindMbedTLS.cmake | ||
FindMSH3.cmake | ||
FindNettle.cmake | ||
FindNGHTTP2.cmake | ||
FindNGHTTP3.cmake | ||
FindNGTCP2.cmake | ||
FindQuiche.cmake | ||
FindRustls.cmake | ||
FindWolfSSH.cmake | ||
FindWolfSSL.cmake | ||
FindZstd.cmake | ||
Macros.cmake | ||
OtherTests.cmake | ||
PickyWarnings.cmake | ||
Utilities.cmake |