CI: Test consuming the exported CMake configs.

This commit is contained in:
Pierre Wendling
2023-08-06 15:08:28 -04:00
parent a89cd65980
commit 3139173568
5 changed files with 141 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
cmake_minimum_required(VERSION 3.5)
project(LibreSSL_Consumer LANGUAGES C)
find_package(
LibreSSL
CONFIG
REQUIRED
COMPONENTS Crypto SSL TLS
)
set(RESULTS_TO_CHECK
"LIBRESSL_VERSION"
"LIBRESSL_FOUND"
"LIBRESSL_INCLUDE_DIR"
"LIBRESSL_LIBRARIES"
"LIBRESSL_CRYPTO_LIBRARY"
"LIBRESSL_SSL_LIBRARY"
"LIBRESSL_TLS_LIBRARY"
)
foreach(RESULT_VAR IN LISTS RESULTS_TO_CHECK)
if(${RESULT_VAR})
message(STATUS "${RESULT_VAR}: ${${RESULT_VAR}}")
else()
message(FATAL_ERROR "${RESULT_VAR} was not set by the package.")
endif()
endforeach()
add_executable(crypto crypto.c)
target_link_libraries(crypto PRIVATE LibreSSL::Crypto)
add_executable(ssl ssl.c)
target_link_libraries(ssl PRIVATE LibreSSL::SSL)
add_executable(tls tls.c)
target_link_libraries(tls PRIVATE LibreSSL::TLS)

7
tests/cmake/crypto.c Normal file
View File

@@ -0,0 +1,7 @@
#include <openssl/crypto.h>
int main(void) {
OPENSSL_init_crypto(0, NULL);
OPENSSL_cleanup();
return 0;
}

6
tests/cmake/ssl.c Normal file
View File

@@ -0,0 +1,6 @@
#include <openssl/ssl.h>
int main(void) {
SSL_library_init();
return 0;
}

6
tests/cmake/tls.c Normal file
View File

@@ -0,0 +1,6 @@
#include <tls.h>
int main(void) {
tls_init();
return 0;
}