cmake: extend zlib's AUTO option to brotli, zstd and enable if found
- make `curl_dependency_option()` more generic.
- extend `CURL_BROTLI` and `CURL_ZSTD` options to accept
`AUTO` in addition to existing `ON` and `OFF`.
- change `CURL_BROTLI` and `CURL_ZSTD` option default
to `AUTO`. Was: `OFF`.
It brings cmake behavior closer to `./configure`.
Still different:
- `./configure` defaults to `off` which means to check default
locations. cmake checks more locations by default.
(Also tried `NO_CMAKE_PATH`, but then it checked less locations.)
- cmake returns both `brotlicommon` and `brotlidec` libs,
while `./configure` only returns the latter.
- ci: drop explicit cmake options, that are now unnecessary.
- GHA/configure-vs-cmake: make adjustments to make tests pass.
Closes #15431
This commit is contained in:
parent
290607f9d4
commit
f2adb3b6d7
7
.github/workflows/configure-vs-cmake.yml
vendored
7
.github/workflows/configure-vs-cmake.yml
vendored
@ -40,11 +40,11 @@ jobs:
|
||||
run: |
|
||||
autoreconf -fi
|
||||
export PKG_CONFIG_DEBUG_SPEW=1
|
||||
mkdir bld-am && cd bld-am && ../configure --enable-static=no --with-openssl --without-libpsl --without-brotli --without-zstd
|
||||
mkdir bld-am && cd bld-am && ../configure --enable-static=no --with-openssl --without-libpsl --without-brotli
|
||||
|
||||
- name: run cmake
|
||||
run: |
|
||||
cmake -B bld-cm -DCURL_USE_LIBPSL=OFF
|
||||
cmake -B bld-cm -DCURL_USE_LIBPSL=OFF -DCURL_BROTLI=OFF
|
||||
|
||||
- name: 'configure log'
|
||||
run: cat bld-am/config.log 2>/dev/null || true
|
||||
@ -80,12 +80,13 @@ jobs:
|
||||
run: |
|
||||
autoreconf -fi
|
||||
export PKG_CONFIG_DEBUG_SPEW=1
|
||||
mkdir bld-am && cd bld-am && ../configure --enable-static=no --with-openssl --without-libpsl --disable-ldap
|
||||
mkdir bld-am && cd bld-am && ../configure --enable-static=no --with-openssl --without-libpsl --disable-ldap --with-zstd
|
||||
|
||||
- name: run cmake
|
||||
run: |
|
||||
cmake -B bld-cm -DCURL_USE_LIBPSL=OFF -DCURL_DISABLE_LDAP=ON \
|
||||
"-DCMAKE_C_COMPILER_TARGET=$(uname -m | sed 's/arm64/aarch64/')-apple-darwin$(uname -r)" \
|
||||
-DCURL_BROTLI=OFF \
|
||||
-DCURL_USE_LIBSSH2=OFF
|
||||
|
||||
- name: 'configure log'
|
||||
|
||||
1
.github/workflows/http3-linux.yml
vendored
1
.github/workflows/http3-linux.yml
vendored
@ -466,7 +466,6 @@ jobs:
|
||||
cmake -B . -G Ninja \
|
||||
-DCMAKE_C_COMPILER_TARGET=$(uname -m)-pc-linux-gnu -DBUILD_STATIC_LIBS=ON \
|
||||
-DCMAKE_UNITY_BUILD=ON -DCURL_TEST_BUNDLES=ON -DCURL_WERROR=ON \
|
||||
-DCURL_BROTLI=ON -DCURL_ZSTD=ON \
|
||||
${{ matrix.build.generate }}
|
||||
else
|
||||
./configure --disable-dependency-tracking --enable-unity --enable-test-bundles --enable-warnings --enable-werror \
|
||||
|
||||
2
.github/workflows/linux-old.yml
vendored
2
.github/workflows/linux-old.yml
vendored
@ -96,7 +96,7 @@ jobs:
|
||||
mkdir bld-cares
|
||||
cd bld-cares
|
||||
cmake .. -DCMAKE_UNITY_BUILD=ON -DCURL_TEST_BUNDLES=ON -DCURL_WERROR=ON -DBUILD_SHARED_LIBS=ON \
|
||||
-DENABLE_ARES=ON -DCURL_ZSTD=ON -DCURL_USE_GSSAPI=ON -DCURL_USE_LIBSSH2=OFF -DCURL_USE_LIBSSH=ON -DUSE_LIBRTMP=ON \
|
||||
-DENABLE_ARES=ON -DCURL_USE_GSSAPI=ON -DCURL_USE_LIBSSH2=OFF -DCURL_USE_LIBSSH=ON -DUSE_LIBRTMP=ON \
|
||||
-DCURL_LIBCURL_VERSIONED_SYMBOLS=ON
|
||||
|
||||
- name: 'cmake curl_config.h'
|
||||
|
||||
1
.github/workflows/linux.yml
vendored
1
.github/workflows/linux.yml
vendored
@ -569,7 +569,6 @@ jobs:
|
||||
cmake -B . -G Ninja \
|
||||
-DCMAKE_C_COMPILER_TARGET=$(uname -m)-pc-linux-gnu -DBUILD_STATIC_LIBS=ON \
|
||||
-DCMAKE_UNITY_BUILD=ON -DCURL_TEST_BUNDLES=ON -DCURL_WERROR=ON \
|
||||
-DCURL_BROTLI=ON -DCURL_ZSTD=ON \
|
||||
${{ matrix.build.generate }}
|
||||
else
|
||||
${{ matrix.build.configure-prefix }} \
|
||||
|
||||
8
.github/workflows/macos.yml
vendored
8
.github/workflows/macos.yml
vendored
@ -159,23 +159,23 @@ jobs:
|
||||
macos-version-min: '10.15'
|
||||
- name: 'wolfSSL !ldap brotli zstd'
|
||||
install: brotli wolfssl zstd
|
||||
generate: -DCURL_USE_WOLFSSL=ON -DCURL_BROTLI=ON -DCURL_ZSTD=ON -DCURL_DISABLE_LDAP=ON -DUSE_ECH=ON
|
||||
generate: -DCURL_USE_WOLFSSL=ON -DCURL_DISABLE_LDAP=ON -DUSE_ECH=ON
|
||||
macos-version-min: '10.15'
|
||||
- name: 'mbedTLS !ldap brotli zstd'
|
||||
install: brotli mbedtls zstd
|
||||
generate: -DCURL_USE_MBEDTLS=ON -DCURL_BROTLI=ON -DCURL_ZSTD=ON -DCURL_DISABLE_LDAP=ON
|
||||
generate: -DCURL_USE_MBEDTLS=ON -DCURL_DISABLE_LDAP=ON
|
||||
macos-version-min: '10.15'
|
||||
- name: 'GnuTLS !ldap krb5'
|
||||
install: gnutls nettle krb5
|
||||
generate: -DCURL_USE_GNUTLS=ON -DCURL_USE_OPENSSL=OFF -DCURL_USE_GSSAPI=ON -DGSS_ROOT_DIR=$(brew --prefix krb5) -DCURL_DISABLE_LDAP=ON
|
||||
macos-version-min: '10.15'
|
||||
- name: 'OpenSSL torture !FTP'
|
||||
generate: -DENABLE_DEBUG=ON -DBUILD_SHARED_LIBS=OFF -DENABLE_THREADED_RESOLVER=OFF -DOPENSSL_ROOT_DIR=$(brew --prefix openssl) -DCURL_BROTLI=ON -DCURL_ZSTD=ON
|
||||
generate: -DENABLE_DEBUG=ON -DBUILD_SHARED_LIBS=OFF -DENABLE_THREADED_RESOLVER=OFF -DOPENSSL_ROOT_DIR=$(brew --prefix openssl)
|
||||
tflags: -t --shallow=25 !FTP
|
||||
macos-version-min: '10.9'
|
||||
torture: true
|
||||
- name: 'OpenSSL torture FTP'
|
||||
generate: -DENABLE_DEBUG=ON -DBUILD_SHARED_LIBS=OFF -DENABLE_THREADED_RESOLVER=OFF -DOPENSSL_ROOT_DIR=$(brew --prefix openssl) -DCURL_BROTLI=ON -DCURL_ZSTD=ON
|
||||
generate: -DENABLE_DEBUG=ON -DBUILD_SHARED_LIBS=OFF -DENABLE_THREADED_RESOLVER=OFF -DOPENSSL_ROOT_DIR=$(brew --prefix openssl)
|
||||
tflags: -t --shallow=20 FTP
|
||||
macos-version-min: '10.9'
|
||||
torture: true
|
||||
|
||||
5
.github/workflows/non-native.yml
vendored
5
.github/workflows/non-native.yml
vendored
@ -61,7 +61,7 @@ jobs:
|
||||
-DCURL_WERROR=ON \
|
||||
-DENABLE_DEBUG=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG= \
|
||||
-DCURL_USE_OPENSSL=ON \
|
||||
-DCURL_BROTLI=ON -DCURL_USE_GSSAPI=ON \
|
||||
-DCURL_USE_GSSAPI=ON \
|
||||
|| { cat bld/CMakeFiles/CMake*.yaml; false; }
|
||||
echo '::group::curl_config.h (raw)'; cat bld/lib/curl_config.h || true; echo '::endgroup::'
|
||||
echo '::group::curl_config.h'; grep -F '#define' bld/lib/curl_config.h | sort || true; echo '::endgroup::'
|
||||
@ -102,7 +102,6 @@ jobs:
|
||||
-DCURL_WERROR=ON \
|
||||
-DENABLE_DEBUG=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG= \
|
||||
-DCURL_USE_OPENSSL=ON \
|
||||
-DCURL_BROTLI=ON \
|
||||
|| { cat bld/CMakeFiles/CMake*.yaml; false; }
|
||||
echo '::group::curl_config.h (raw)'; cat bld/lib/curl_config.h || true; echo '::endgroup::'
|
||||
echo '::group::curl_config.h'; grep -F '#define' bld/lib/curl_config.h | sort || true; echo '::endgroup::'
|
||||
@ -179,7 +178,7 @@ jobs:
|
||||
-DCURL_WERROR=ON \
|
||||
-DENABLE_DEBUG=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG= \
|
||||
-DCURL_USE_OPENSSL=ON \
|
||||
-DCURL_BROTLI=ON -DCURL_USE_GSSAPI=ON \
|
||||
-DCURL_USE_GSSAPI=ON \
|
||||
|| { cat bld/CMakeFiles/CMake*.yaml; false; }
|
||||
echo '::group::curl_config.h (raw)'; cat bld/lib/curl_config.h || true; echo '::endgroup::'
|
||||
echo '::group::curl_config.h'; grep -F '#define' bld/lib/curl_config.h | sort || true; echo '::endgroup::'
|
||||
|
||||
18
.github/workflows/windows.yml
vendored
18
.github/workflows/windows.yml
vendored
@ -86,7 +86,6 @@ jobs:
|
||||
cmake -B bld -G Ninja ${options} \
|
||||
-DCMAKE_UNITY_BUILD=ON -DCURL_TEST_BUNDLES=ON \
|
||||
-DCURL_WERROR=ON \
|
||||
-DCURL_BROTLI=ON \
|
||||
${{ matrix.config }}
|
||||
else
|
||||
PATH="/usr/bin:$(cygpath "${SYSTEMROOT}")/System32"
|
||||
@ -257,7 +256,6 @@ jobs:
|
||||
'-DCMAKE_BUILD_TYPE=${{ matrix.type }}' \
|
||||
-DCMAKE_UNITY_BUILD=ON -DCURL_TEST_BUNDLES=ON \
|
||||
-DCURL_WERROR=ON \
|
||||
-DCURL_BROTLI=ON \
|
||||
${{ matrix.config }}
|
||||
else
|
||||
mkdir bld && cd bld && ../configure --enable-unity --enable-test-bundles --enable-warnings --enable-werror \
|
||||
@ -581,7 +579,7 @@ jobs:
|
||||
type: 'Debug'
|
||||
tflags: '~1516 ~2301 ~2302 ~2303 ~2307'
|
||||
config: >-
|
||||
-DCURL_BROTLI=ON -DCURL_ZSTD=ON -DCURL_USE_LIBSSH2=ON
|
||||
-DCURL_USE_LIBSSH2=ON
|
||||
-DCURL_USE_SCHANNEL=ON -DCURL_USE_OPENSSL=ON -DCURL_USE_MBEDTLS=ON -DCURL_DEFAULT_SSL_BACKEND=schannel
|
||||
-DCURL_USE_GSASL=ON -DUSE_WIN32_IDN=ON -DENABLE_UNICODE=ON
|
||||
|
||||
@ -592,7 +590,7 @@ jobs:
|
||||
type: 'Debug'
|
||||
tflags: '~1516 ~2301 ~2302 ~2303 ~2307'
|
||||
config: >-
|
||||
-DCURL_BROTLI=ON -DCURL_ZSTD=ON -DCURL_USE_LIBSSH2=ON
|
||||
-DCURL_USE_LIBSSH2=ON
|
||||
-DCURL_USE_SCHANNEL=OFF -DCURL_USE_OPENSSL=ON -DUSE_OPENSSL_QUIC=ON
|
||||
-DCURL_USE_GSASL=ON -DENABLE_ARES=ON -DCURL_USE_LIBUV=ON -DCURL_USE_GSSAPI=ON
|
||||
|
||||
@ -603,7 +601,7 @@ jobs:
|
||||
type: 'Debug'
|
||||
tflags: 'skiprun'
|
||||
config: >-
|
||||
-DCURL_BROTLI=ON -DCURL_ZSTD=ON -DCURL_USE_LIBSSH2=ON
|
||||
-DCURL_USE_LIBSSH2=ON
|
||||
-DCURL_USE_SCHANNEL=OFF -DCURL_USE_OPENSSL=ON -DUSE_OPENSSL_QUIC=ON
|
||||
-DCURL_USE_LIBPSL=OFF
|
||||
|
||||
@ -614,7 +612,7 @@ jobs:
|
||||
type: 'Debug'
|
||||
tflags: '~1516 ~2301 ~2302 ~2303 ~2307'
|
||||
config: >-
|
||||
-DCURL_BROTLI=ON -DCURL_ZSTD=ON -DCURL_USE_LIBSSH2=ON
|
||||
-DCURL_USE_LIBSSH2=ON
|
||||
-DCURL_USE_SCHANNEL=OFF -DCURL_USE_OPENSSL=ON -DUSE_NGTCP2=ON
|
||||
-DCURL_CA_SEARCH_SAFE=ON
|
||||
|
||||
@ -625,7 +623,7 @@ jobs:
|
||||
type: 'Debug'
|
||||
tflags: '~1516 ~2301 ~2302 ~2303 ~2307'
|
||||
config: >-
|
||||
-DCURL_BROTLI=ON -DCURL_ZSTD=ON -DCURL_USE_LIBSSH2=ON
|
||||
-DCURL_USE_LIBSSH2=ON
|
||||
-DCURL_USE_SCHANNEL=OFF -DCURL_USE_OPENSSL=ON
|
||||
-DUSE_ECH=ON
|
||||
|
||||
@ -636,7 +634,7 @@ jobs:
|
||||
type: 'Debug'
|
||||
tflags: '~1516'
|
||||
config: >-
|
||||
-DCURL_BROTLI=ON -DCURL_ZSTD=ON -DCURL_USE_LIBSSH2=ON
|
||||
-DCURL_USE_LIBSSH2=ON
|
||||
-DCURL_USE_SCHANNEL=OFF -DCURL_USE_WOLFSSL=ON -DUSE_NGTCP2=ON
|
||||
-DCURL_USE_GSASL=ON
|
||||
-DUSE_ECH=ON
|
||||
@ -652,7 +650,7 @@ jobs:
|
||||
# Windows. Do not use this component till there is a fix for these.
|
||||
# https://github.com/curl/curl-for-win/blob/3951808deb04df9489ee17430f236ed54436f81a/libssh.sh#L6-L8
|
||||
config: >-
|
||||
-DCURL_BROTLI=ON -DCURL_ZSTD=ON -DCURL_USE_LIBSSH2=OFF -DCURL_USE_LIBSSH=ON
|
||||
-DCURL_USE_LIBSSH2=OFF -DCURL_USE_LIBSSH=ON
|
||||
-DCURL_USE_SCHANNEL=OFF -DCURL_USE_MBEDTLS=ON
|
||||
-DCURL_USE_GSASL=ON
|
||||
|
||||
@ -663,7 +661,7 @@ jobs:
|
||||
type: 'Debug'
|
||||
tflags: 'skipall'
|
||||
config: >-
|
||||
-DCURL_BROTLI=ON -DCURL_ZSTD=ON -DCURL_USE_LIBSSH2=ON
|
||||
-DCURL_USE_LIBSSH2=ON
|
||||
-DCURL_USE_SCHANNEL=OFF -DUSE_MSH3=ON
|
||||
-DCURL_USE_GSASL=ON
|
||||
|
||||
|
||||
@ -62,14 +62,14 @@ macro(curl_internal_test _curl_test)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(curl_dependency_option _dependency)
|
||||
set(CURL_${_dependency} "AUTO" CACHE STRING "Build curl with ${_dependency} support (AUTO, ON or OFF)")
|
||||
set_property(CACHE CURL_${_dependency} PROPERTY STRINGS "AUTO" "ON" "OFF")
|
||||
macro(curl_dependency_option _option_name _find_name _desc_name)
|
||||
set(${_option_name} "AUTO" CACHE STRING "Build curl with ${_desc_name} support (AUTO, ON or OFF)")
|
||||
set_property(CACHE ${_option_name} PROPERTY STRINGS "AUTO" "ON" "OFF")
|
||||
|
||||
if(CURL_${_dependency} STREQUAL "AUTO")
|
||||
find_package(${_dependency})
|
||||
elseif(CURL_${_dependency})
|
||||
find_package(${_dependency} REQUIRED)
|
||||
if(${_option_name} STREQUAL "AUTO")
|
||||
find_package(${_find_name})
|
||||
elseif(${_option_name})
|
||||
find_package(${_find_name} REQUIRED)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
|
||||
@ -825,38 +825,33 @@ endif()
|
||||
# and before calling curl_openssl_check_symbol_exists().
|
||||
|
||||
set(HAVE_LIBZ OFF)
|
||||
curl_dependency_option(ZLIB)
|
||||
curl_dependency_option(CURL_ZLIB ZLIB "ZLIB")
|
||||
if(ZLIB_FOUND)
|
||||
set(HAVE_LIBZ ON)
|
||||
|
||||
# Depend on ZLIB via imported targets. This allows our dependents to
|
||||
# get our dependencies transitively.
|
||||
list(APPEND CURL_LIBS ZLIB::ZLIB)
|
||||
list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "zlib")
|
||||
endif()
|
||||
|
||||
option(CURL_BROTLI "Use brotli" OFF)
|
||||
set(HAVE_BROTLI OFF)
|
||||
if(CURL_BROTLI)
|
||||
find_package(Brotli REQUIRED)
|
||||
if(BROTLI_FOUND)
|
||||
set(HAVE_BROTLI ON)
|
||||
list(APPEND CURL_LIBS ${BROTLI_LIBRARIES})
|
||||
list(APPEND CURL_LIBDIRS ${BROTLI_LIBRARY_DIRS})
|
||||
list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "libbrotlidec")
|
||||
include_directories(SYSTEM ${BROTLI_INCLUDE_DIRS})
|
||||
link_directories(${BROTLI_LIBRARY_DIRS})
|
||||
if(BROTLI_CFLAGS)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${BROTLI_CFLAGS}")
|
||||
endif()
|
||||
curl_dependency_option(CURL_BROTLI Brotli "brotli")
|
||||
if(BROTLI_FOUND)
|
||||
set(HAVE_BROTLI ON)
|
||||
list(APPEND CURL_LIBS ${BROTLI_LIBRARIES})
|
||||
list(APPEND CURL_LIBDIRS ${BROTLI_LIBRARY_DIRS})
|
||||
list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "libbrotlidec")
|
||||
include_directories(SYSTEM ${BROTLI_INCLUDE_DIRS})
|
||||
link_directories(${BROTLI_LIBRARY_DIRS})
|
||||
if(BROTLI_CFLAGS)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${BROTLI_CFLAGS}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
option(CURL_ZSTD "Use zstd" OFF)
|
||||
set(HAVE_ZSTD OFF)
|
||||
if(CURL_ZSTD)
|
||||
find_package(Zstd REQUIRED)
|
||||
if(ZSTD_FOUND AND NOT ZSTD_VERSION VERSION_LESS 1.0.0)
|
||||
curl_dependency_option(CURL_ZSTD Zstd "zstd")
|
||||
if(ZSTD_FOUND)
|
||||
if(NOT ZSTD_VERSION VERSION_LESS 1.0.0)
|
||||
set(HAVE_ZSTD ON)
|
||||
list(APPEND CURL_LIBS ${ZSTD_LIBRARIES})
|
||||
list(APPEND CURL_LIBDIRS ${ZSTD_LIBRARY_DIRS})
|
||||
|
||||
@ -265,7 +265,7 @@ Details via CMake
|
||||
|
||||
## Dependencies
|
||||
|
||||
- `CURL_BROTLI`: Use brotli. Default: `OFF`
|
||||
- `CURL_BROTLI`: Use brotli (`ON`, `OFF` or `AUTO`). Default: `AUTO`
|
||||
- `CURL_USE_BEARSSL`: Enable BearSSL for SSL/TLS. Default: `OFF`
|
||||
- `CURL_USE_GNUTLS`: Enable GnuTLS for SSL/TLS. Default: `OFF`
|
||||
- `CURL_USE_GSASL`: Use libgsasl. Default: `OFF`
|
||||
@ -283,7 +283,7 @@ Details via CMake
|
||||
- `CURL_USE_WOLFSSH`: Use wolfSSH. Default: `OFF`
|
||||
- `CURL_USE_WOLFSSL`: Enable wolfSSL for SSL/TLS. Default: `OFF`
|
||||
- `CURL_ZLIB`: Use zlib (`ON`, `OFF` or `AUTO`). Default: `AUTO`
|
||||
- `CURL_ZSTD`: Use zstd. Default: `OFF`
|
||||
- `CURL_ZSTD`: Use zstd (`ON`, `OFF` or `AUTO`). Default: `AUTO`
|
||||
- `ENABLE_ARES`: Enable c-ares support. Default: `OFF`
|
||||
- `USE_APPLE_IDN`: Use Apple built-in IDN support. Default: `OFF`
|
||||
- `USE_LIBIDN2`: Use libidn2 for IDN support. Default: `ON`
|
||||
|
||||
Loading…
Reference in New Issue
Block a user