1
0
mirror of https://github.com/libssh2/libssh2.git synced 2025-08-05 20:55:47 +03:00

cmake: streamline invocation

Stop specifiying the current directory.
Simplify build instructions.

Closes #1138
This commit is contained in:
Viktor Szakats
2023-07-26 22:32:00 +00:00
parent c515eed398
commit f58f77b5c8
3 changed files with 15 additions and 9 deletions

View File

@@ -90,7 +90,7 @@ jobs:
curl -L https://github.com/Mbed-TLS/mbedtls/archive/$MBEDTLSVER.tar.gz | tar -xzf - curl -L https://github.com/Mbed-TLS/mbedtls/archive/$MBEDTLSVER.tar.gz | tar -xzf -
cd mbedtls-$MBEDTLSVER cd mbedtls-$MBEDTLSVER
[ '${{ matrix.arch }}' = 'i386' ] && crossoptions='-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_SYSTEM_VERSION=1 -DCMAKE_SYSTEM_PROCESSOR=${{ matrix.arch }} -DCMAKE_C_FLAGS=-m32' [ '${{ matrix.arch }}' = 'i386' ] && crossoptions='-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_SYSTEM_VERSION=1 -DCMAKE_SYSTEM_PROCESSOR=${{ matrix.arch }} -DCMAKE_C_FLAGS=-m32'
cmake . ${crossoptions} \ cmake ${crossoptions} \
-DUSE_SHARED_MBEDTLS_LIBRARY=ON \ -DUSE_SHARED_MBEDTLS_LIBRARY=ON \
-DCMAKE_INSTALL_PREFIX:PATH=../usr -DCMAKE_INSTALL_PREFIX:PATH=../usr
make -j3 install make -j3 install
@@ -126,7 +126,7 @@ jobs:
if: ${{ matrix.build == 'cmake' }} if: ${{ matrix.build == 'cmake' }}
run: | run: |
[ '${{ matrix.arch }}' = 'i386' ] && crossoptions='-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_SYSTEM_VERSION=1 -DCMAKE_SYSTEM_PROCESSOR=${{ matrix.arch }} -DCMAKE_C_FLAGS=-m32' [ '${{ matrix.arch }}' = 'i386' ] && crossoptions='-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_SYSTEM_VERSION=1 -DCMAKE_SYSTEM_PROCESSOR=${{ matrix.arch }} -DCMAKE_C_FLAGS=-m32'
cmake . -B bld ${crossoptions} $TOOLCHAIN_OPTION \ cmake -B bld ${crossoptions} $TOOLCHAIN_OPTION \
-DENABLE_WERROR=ON \ -DENABLE_WERROR=ON \
-DCRYPTO_BACKEND=${{ matrix.crypto }} \ -DCRYPTO_BACKEND=${{ matrix.crypto }} \
-DENABLE_ZLIB_COMPRESSION=${{ matrix.zlib }} -DENABLE_ZLIB_COMPRESSION=${{ matrix.zlib }}
@@ -202,7 +202,7 @@ jobs:
else else
options='-DCMAKE_C_COMPILER=gcc' options='-DCMAKE_C_COMPILER=gcc'
fi fi
cmake . -B bld ${options} \ cmake -B bld ${options} \
-DENABLE_WERROR=ON \ -DENABLE_WERROR=ON \
-DENABLE_DEBUG_LOGGING=ON \ -DENABLE_DEBUG_LOGGING=ON \
-DCRYPTO_BACKEND=OpenSSL \ -DCRYPTO_BACKEND=OpenSSL \
@@ -256,7 +256,7 @@ jobs:
else else
system='Windows' system='Windows'
fi fi
cmake . -B bld ${options} \ cmake -B bld ${options} \
-DCMAKE_SYSTEM_NAME=${system} \ -DCMAKE_SYSTEM_NAME=${system} \
-DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake \ -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake \
-DCMAKE_GENERATOR_PLATFORM=${archgen} \ -DCMAKE_GENERATOR_PLATFORM=${archgen} \
@@ -337,7 +337,7 @@ jobs:
- name: 'cmake configure' - name: 'cmake configure'
if: ${{ matrix.build == 'cmake' }} if: ${{ matrix.build == 'cmake' }}
run: | run: |
cmake . -B bld ${{ matrix.crypto.cmake }} \ cmake -B bld ${{ matrix.crypto.cmake }} \
-DCMAKE_UNITY_BUILD=ON \ -DCMAKE_UNITY_BUILD=ON \
-DENABLE_WERROR=ON \ -DENABLE_WERROR=ON \
-DENABLE_DEBUG_LOGGING=ON \ -DENABLE_DEBUG_LOGGING=ON \

View File

@@ -173,7 +173,7 @@ build_script:
# FIXME: First sshd test sometimes timeouts, subsequent ones almost always fail: # FIXME: First sshd test sometimes timeouts, subsequent ones almost always fail:
# 'libssh2_session_handshake failed (-43): Failed getting banner' # 'libssh2_session_handshake failed (-43): Failed getting banner'
- echo cmake "-G%GENERATOR%" %CMAKE_ARG% -DENABLE_WERROR=ON -DCRYPTO_BACKEND=%CRYPTO_BACKEND% -DRUN_SSHD_TESTS=OFF - echo cmake "-G%GENERATOR%" %CMAKE_ARG% -DENABLE_WERROR=ON -DCRYPTO_BACKEND=%CRYPTO_BACKEND% -DRUN_SSHD_TESTS=OFF
- cmake . -B _builds "-G%GENERATOR%" %CMAKE_ARG% -DENABLE_WERROR=ON -DCRYPTO_BACKEND=%CRYPTO_BACKEND% -DRUN_SSHD_TESTS=OFF - cmake -B _builds "-G%GENERATOR%" %CMAKE_ARG% -DENABLE_WERROR=ON -DCRYPTO_BACKEND=%CRYPTO_BACKEND% -DRUN_SSHD_TESTS=OFF
- cmake --build _builds --config "%CONFIGURATION%" - cmake --build _builds --config "%CONFIGURATION%"
test_script: test_script:

View File

@@ -22,8 +22,14 @@ If you are happy with the default options, make a new build directory,
change to it, configure the build environment and build the project: change to it, configure the build environment and build the project:
``` ```
mkdir bin cmake -B bld
cd bin cmake --build bld
```
Use this with CMake 3.12.x or older:
```
mkdir bld
cd bld
cmake .. cmake ..
cmake --build . cmake --build .
``` ```