mirror of
https://github.com/curl/curl.git
synced 2026-06-16 16:25:38 +03:00
cmake: test integration with old cmake (v3.11.4 2018-03-28)
Tests with old cmake are slow. (no Ninja, no unity, and running slower
than recent versions.)
It also revealed that 3.7.2 2017-01-13 is too old to consume curl via
`find_package()` due to:
```
CMake Error at bld-curl/_pkg/lib/cmake/CURL/CURLConfig.cmake:69 (add_library):
add_library cannot create ALIAS target "CURL::libcurl" because target
"CURL::libcurl_shared" is IMPORTED.
Call Stack (most recent call first):
CMakeLists.txt:48 (find_package)
CMake Error at bld-curl/_pkg/lib/cmake/CURL/CURLConfig.cmake:69 (add_library):
add_library cannot create ALIAS target "CURL::libcurl" because target
"CURL::libcurl_shared" is IMPORTED.
Call Stack (most recent call first):
CMakeLists.txt:49 (find_package)
```
The mitigation for this issue requires 3.11.
Also:
- rename a few existing envs to use the `TEST_` prefix.
- make the `find_package` test provider stage verbose.
- fix issue when consuming with cmake 3.7.2 (all platforms):
```
CMake Error at /home/runner/cmake-3.7.2-Linux-x86_64/share/cmake-3.7/Modules/CMakeFindDependencyMacro.cmake:25 (message):
Invalid arguments to find_dependency. VERSION is empty
Call Stack (most recent call first):
bld-curl/_pkg/lib/cmake/CURL/CURLConfig.cmake:52 (find_dependency)
CMakeLists.txt:48 (find_package)
```
Ref: https://github.com/curl/curl/actions/runs/14906066962/job/41868621979?pr=17293#step:9:1199
Closes #17293
This commit is contained in:
parent
4190c73094
commit
5b454bae0c
3 changed files with 73 additions and 19 deletions
46
.github/workflows/distcheck.yml
vendored
46
.github/workflows/distcheck.yml
vendored
|
|
@ -173,6 +173,7 @@ jobs:
|
|||
env:
|
||||
CC: ${{ !contains(matrix.image, 'windows') && 'clang' || '' }}
|
||||
TESTOPTS: ${{ contains(matrix.image, 'macos') && '-D_CURL_PREFILL=ON' || '' }} ${{ contains(matrix.image, 'windows') && '-DCMAKE_UNITY_BUILD_BATCH_SIZE=30' || '' }}
|
||||
old-cmake-version: 3.11.4
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
|
|
@ -190,21 +191,62 @@ jobs:
|
|||
mingw-w64-x86_64-zlib mingw-w64-x86_64-zstd mingw-w64-x86_64-libpsl mingw-w64-x86_64-libssh2 mingw-w64-x86_64-nghttp2 mingw-w64-x86_64-openssl
|
||||
|
||||
- name: 'install prereqs'
|
||||
if: ${{ !contains(matrix.image, 'windows') }}
|
||||
run: |
|
||||
if [[ '${{ matrix.image }}' = *'ubuntu'* ]]; then
|
||||
if [[ '${{ matrix.image }}' = *'windows'* ]]; then
|
||||
cd "${HOME}" || exit 1
|
||||
curl --disable --fail --silent --show-error --connect-timeout 15 --max-time 60 --retry 3 --retry-connrefused \
|
||||
--location 'https://github.com/Kitware/CMake/releases/download/v${{ env.old-cmake-version }}/cmake-${{ env.old-cmake-version }}-win64-x64.zip' --output bin.zip
|
||||
unzip -q bin.zip
|
||||
rm -f bin.zip
|
||||
printf '%s' "${HOME}/cmake-${{ env.old-cmake-version }}-win64-x64/bin/cmake.exe" > "${HOME}/old-cmake-path.txt"
|
||||
elif [[ '${{ matrix.image }}' = *'ubuntu'* ]]; then
|
||||
sudo rm -f /var/lib/man-db/auto-update
|
||||
sudo apt-get -o Dpkg::Use-Pty=0 install libpsl-dev libssl-dev
|
||||
cd "${HOME}" || exit 1
|
||||
curl --disable --fail --silent --show-error --connect-timeout 15 --max-time 60 --retry 3 --retry-connrefused \
|
||||
--location https://github.com/Kitware/CMake/releases/download/v${{ env.old-cmake-version }}/cmake-${{ env.old-cmake-version }}-Linux-x86_64.tar.gz | tar -xzf -
|
||||
printf '%s' "$PWD/cmake-${{ env.old-cmake-version }}-Linux-x86_64/bin/cmake" > "${HOME}/old-cmake-path.txt"
|
||||
else
|
||||
brew install libpsl openssl
|
||||
cd "${HOME}" || exit 1
|
||||
curl --disable --fail --silent --show-error --connect-timeout 15 --max-time 60 --retry 3 --retry-connrefused \
|
||||
--location https://github.com/Kitware/CMake/releases/download/v${{ env.old-cmake-version }}/cmake-${{ env.old-cmake-version }}-Darwin-x86_64.tar.gz | tar -xzf -
|
||||
printf '%s' "$PWD/cmake-${{ env.old-cmake-version }}-Darwin-x86_64/CMake.app/Contents/bin/cmake" > "${HOME}/old-cmake-path.txt"
|
||||
fi
|
||||
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: 'via FetchContent'
|
||||
run: ./tests/cmake/test.sh FetchContent ${TESTOPTS} -DCURL_USE_OPENSSL=ON
|
||||
- name: 'via add_subdirectory'
|
||||
run: ./tests/cmake/test.sh add_subdirectory ${TESTOPTS} -DCURL_USE_OPENSSL=ON
|
||||
- name: 'via find_package'
|
||||
run: ./tests/cmake/test.sh find_package ${TESTOPTS} -DCURL_USE_OPENSSL=ON
|
||||
|
||||
- name: 'via add_subdirectory OpenSSL (old cmake)'
|
||||
run: |
|
||||
export TEST_CMAKE_CONSUMER="$(cat "${HOME}/old-cmake-path.txt")"
|
||||
if [[ '${{ matrix.image }}' = *'macos'* ]]; then
|
||||
export CFLAGS='-arch arm64'
|
||||
export TEST_CMAKE_FLAGS='-DCURL_USE_LIBPSL=OFF' # auto-detection does not work with old-cmake
|
||||
fi
|
||||
if [[ '${{ matrix.image }}' = *'windows'* ]]; then
|
||||
export TEST_CMAKE_GENERATOR='MSYS Makefiles'
|
||||
export TEST_CMAKE_FLAGS='-DCMAKE_C_COMPILER=x86_64-w64-mingw32-gcc -DOPENSSL_ROOT_DIR=C:/msys64/mingw64'
|
||||
fi
|
||||
./tests/cmake/test.sh add_subdirectory ${TESTOPTS} -DCURL_USE_OPENSSL=ON ${options}
|
||||
|
||||
- name: 'via find_package OpenSSL (old cmake)'
|
||||
run: |
|
||||
export TEST_CMAKE_CONSUMER="$(cat "${HOME}/old-cmake-path.txt")"
|
||||
if [[ '${{ matrix.image }}' = *'macos'* ]]; then
|
||||
export CFLAGS='-arch arm64'
|
||||
export TEST_CMAKE_FLAGS='-DCURL_USE_LIBPSL=OFF' # auto-detection does not work with old-cmake
|
||||
fi
|
||||
if [[ '${{ matrix.image }}' = *'windows'* ]]; then
|
||||
export TEST_CMAKE_GENERATOR='MSYS Makefiles'
|
||||
export TEST_CMAKE_FLAGS='-DCMAKE_C_COMPILER=x86_64-w64-mingw32-gcc -DOPENSSL_ROOT_DIR=C:/msys64/mingw64'
|
||||
fi
|
||||
./tests/cmake/test.sh find_package ${TESTOPTS} -DCURL_USE_OPENSSL=ON ${options}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue