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.
This commit is contained in:
@@ -58,9 +58,29 @@ if (WIN32)
|
||||
endif()
|
||||
set_target_properties(tls PROPERTIES
|
||||
OUTPUT_NAME tls${TLS_POSTFIX}
|
||||
ARCHIVE_OUTPUT_NAME tls${TLS_POSTFIX})
|
||||
set_target_properties(tls PROPERTIES VERSION ${TLS_VERSION}
|
||||
SOVERSION ${TLS_MAJOR_VERSION})
|
||||
ARCHIVE_OUTPUT_NAME tls${TLS_POSTFIX}
|
||||
EXPORT_NAME TLS
|
||||
VERSION ${TLS_VERSION}
|
||||
SOVERSION ${TLS_MAJOR_VERSION}
|
||||
)
|
||||
|
||||
target_include_directories(
|
||||
tls
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include>
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
||||
)
|
||||
|
||||
install(
|
||||
TARGETS tls
|
||||
EXPORT TLS-target
|
||||
)
|
||||
|
||||
export(
|
||||
EXPORT TLS-target
|
||||
FILE "${LibreSSL_BINARY_DIR}/LibreSSL-TLS.cmake"
|
||||
NAMESPACE LibreSSL::
|
||||
)
|
||||
|
||||
if(ENABLE_LIBRESSL_INSTALL)
|
||||
install(
|
||||
@@ -69,6 +89,12 @@ if(ENABLE_LIBRESSL_INSTALL)
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
)
|
||||
install(
|
||||
EXPORT TLS-target
|
||||
FILE "LibreSSL-TLS.cmake"
|
||||
NAMESPACE LibreSSL::
|
||||
DESTINATION "${LIBRESSL_INSTALL_CMAKEDIR}/LibreSSL"
|
||||
)
|
||||
endif(ENABLE_LIBRESSL_INSTALL)
|
||||
|
||||
# build static library for regression test
|
||||
|
Reference in New Issue
Block a user