aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/cmake_config.yml85
-rw-r--r--tests/cmake/CMakeLists.txt37
-rw-r--r--tests/cmake/crypto.c7
-rw-r--r--tests/cmake/ssl.c6
-rw-r--r--tests/cmake/tls.c6
5 files changed, 141 insertions, 0 deletions
diff --git a/.github/workflows/cmake_config.yml b/.github/workflows/cmake_config.yml
new file mode 100644
index 0000000..ad1ad75
--- /dev/null
+++ b/.github/workflows/cmake_config.yml
@@ -0,0 +1,85 @@
1name: cmake_config
2
3on: [push, pull_request]
4
5jobs:
6 cmake-check:
7 defaults:
8 run:
9 shell: bash
10 strategy:
11 matrix:
12 os: [windows-latest, macos-latest, ubuntu-latest]
13 runs-on: ${{ matrix.os }}
14 continue-on-error: false
15 name: ${{ matrix.os }}
16 steps:
17 - name: Setup Windows dependencies
18 if: runner.os == 'Windows'
19 uses: msys2/setup-msys2@v2
20 with:
21 update: true
22 install: >-
23 autoconf
24 automake
25 diffutils
26 libtool
27 gcc
28 git
29 patch
30 perl
31
32 - name: Setup macOS dependencies
33 if: runner.os == 'macOS'
34 run: brew install automake
35
36 - uses: actions/checkout@main
37
38 - name: Prepare source tree for build (Windows)
39 if: runner.os == 'Windows'
40 run: ./autogen.sh
41 shell: msys2 {0}
42
43 - name: Prepare source tree for build (Unix)
44 if: runner.os != 'Windows'
45 run: ./autogen.sh
46
47 - name: Configure
48 run: |
49 cmake -S . \
50 -B build \
51 -D CMAKE_BUILD_TYPE=Release \
52 -D CMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/../local
53
54 - name: Build
55 run: cmake --build build --config Release --verbose
56
57 - name: Install
58 run: cmake --install build --config Release
59
60 - name: Consume from the build directory - Configure
61 run: |
62 cmake -S tests/cmake \
63 -B consumer-build \
64 -D CMAKE_BUILD_TYPE=Release \
65 -D LibreSSL_DIR=$GITHUB_WORKSPACE/build
66 - name: Consume from the build directory - Build
67 run: cmake --build consumer-build --config Release --verbose
68
69 - name: Consume from the install directory (CMAKE_PREFIX_PATH) - Configure
70 run: |
71 cmake -S tests/cmake \
72 -B consumer-install-prefix \
73 -D CMAKE_BUILD_TYPE=Release \
74 -D CMAKE_PREFIX_PATH=$GITHUB_WORKSPACE/../local
75 - name: Consume from the install directory (CMAKE_PREFIX_PATH) - Build
76 run: cmake --build consumer-install-prefix --config Release --verbose
77
78 - name: Consume from the install directory (LibreSSL_DIR) - Configure
79 run: |
80 cmake -S tests/cmake \
81 -B consumer-install-dir \
82 -D CMAKE_BUILD_TYPE=Release \
83 -D LibreSSL_DIR=$GITHUB_WORKSPACE/../local/lib/cmake/LibreSSL
84 - name: Consume from the install directory (LibreSSL_DIR) - Build
85 run: cmake --build consumer-install-dir --config Release --verbose
diff --git a/tests/cmake/CMakeLists.txt b/tests/cmake/CMakeLists.txt
new file mode 100644
index 0000000..956fbfd
--- /dev/null
+++ b/tests/cmake/CMakeLists.txt
@@ -0,0 +1,37 @@
1cmake_minimum_required(VERSION 3.5)
2
3project(LibreSSL_Consumer LANGUAGES C)
4
5find_package(
6 LibreSSL
7 CONFIG
8 REQUIRED
9 COMPONENTS Crypto SSL TLS
10)
11
12set(RESULTS_TO_CHECK
13 "LIBRESSL_VERSION"
14 "LIBRESSL_FOUND"
15 "LIBRESSL_INCLUDE_DIR"
16 "LIBRESSL_LIBRARIES"
17 "LIBRESSL_CRYPTO_LIBRARY"
18 "LIBRESSL_SSL_LIBRARY"
19 "LIBRESSL_TLS_LIBRARY"
20)
21
22foreach(RESULT_VAR IN LISTS RESULTS_TO_CHECK)
23 if(${RESULT_VAR})
24 message(STATUS "${RESULT_VAR}: ${${RESULT_VAR}}")
25 else()
26 message(FATAL_ERROR "${RESULT_VAR} was not set by the package.")
27 endif()
28endforeach()
29
30add_executable(crypto crypto.c)
31target_link_libraries(crypto PRIVATE LibreSSL::Crypto)
32
33add_executable(ssl ssl.c)
34target_link_libraries(ssl PRIVATE LibreSSL::SSL)
35
36add_executable(tls tls.c)
37target_link_libraries(tls PRIVATE LibreSSL::TLS)
diff --git a/tests/cmake/crypto.c b/tests/cmake/crypto.c
new file mode 100644
index 0000000..3838180
--- /dev/null
+++ b/tests/cmake/crypto.c
@@ -0,0 +1,7 @@
1#include <openssl/crypto.h>
2
3int main(void) {
4 OPENSSL_init_crypto(0, NULL);
5 OPENSSL_cleanup();
6 return 0;
7}
diff --git a/tests/cmake/ssl.c b/tests/cmake/ssl.c
new file mode 100644
index 0000000..2123d6a
--- /dev/null
+++ b/tests/cmake/ssl.c
@@ -0,0 +1,6 @@
1#include <openssl/ssl.h>
2
3int main(void) {
4 SSL_library_init();
5 return 0;
6}
diff --git a/tests/cmake/tls.c b/tests/cmake/tls.c
new file mode 100644
index 0000000..1493ab0
--- /dev/null
+++ b/tests/cmake/tls.c
@@ -0,0 +1,6 @@
1#include <tls.h>
2
3int main(void) {
4 tls_init();
5 return 0;
6}