From a89cd65980153ef60b42cb26d3bef949751f87f1 Mon Sep 17 00:00:00 2001 From: Pierre Wendling Date: Sun, 6 Aug 2023 15:07:31 -0400 Subject: CMake: Export and install library targets. The configs can be consumed by setting LibreSSL_DIR to the build directory, or after installation using CMAKE_PREFIX_PATH/LibreSSL_DIR. For compatibility, the EXPORT_NAME of targets and the LIBRESSL_* variables are set to match the names used in FindLibreSSL. --- ssl/CMakeLists.txt | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) (limited to 'ssl') diff --git a/ssl/CMakeLists.txt b/ssl/CMakeLists.txt index 3d5b5df..16ef277 100644 --- a/ssl/CMakeLists.txt +++ b/ssl/CMakeLists.txt @@ -91,9 +91,29 @@ if (WIN32) endif() set_target_properties(ssl PROPERTIES OUTPUT_NAME ssl${SSL_POSTFIX} - ARCHIVE_OUTPUT_NAME ssl${SSL_POSTFIX}) -set_target_properties(ssl PROPERTIES VERSION ${SSL_VERSION} - SOVERSION ${SSL_MAJOR_VERSION}) + ARCHIVE_OUTPUT_NAME ssl${SSL_POSTFIX} + EXPORT_NAME SSL + VERSION ${SSL_VERSION} + SOVERSION ${SSL_MAJOR_VERSION} +) + +target_include_directories( + ssl + PUBLIC + $ + $ +) + +install( + TARGETS ssl + EXPORT SSL-target +) + +export( + EXPORT SSL-target + FILE "${LibreSSL_BINARY_DIR}/LibreSSL-SSL.cmake" + NAMESPACE LibreSSL:: +) if(ENABLE_LIBRESSL_INSTALL) install( @@ -102,6 +122,12 @@ if(ENABLE_LIBRESSL_INSTALL) LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ) + install( + EXPORT SSL-target + FILE "LibreSSL-SSL.cmake" + NAMESPACE LibreSSL:: + DESTINATION "${LIBRESSL_INSTALL_CMAKEDIR}/LibreSSL" + ) endif(ENABLE_LIBRESSL_INSTALL) # build static library for regression test -- cgit v1.2.3-55-g6feb