diff options
author | Pierre Wendling <pierre.wendling.4@gmail.com> | 2023-08-06 15:07:31 -0400 |
---|---|---|
committer | Pierre Wendling <pierre.wendling.4@gmail.com> | 2023-08-19 12:16:15 -0400 |
commit | a89cd65980153ef60b42cb26d3bef949751f87f1 (patch) | |
tree | 15d4693562c401d0bbc0b3812d983ca1ac0391cb /ssl | |
parent | 5432e22b25026fb50b00ab5dcf894e18daa8bcb6 (diff) | |
download | portable-a89cd65980153ef60b42cb26d3bef949751f87f1.tar.gz portable-a89cd65980153ef60b42cb26d3bef949751f87f1.tar.bz2 portable-a89cd65980153ef60b42cb26d3bef949751f87f1.zip |
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.
Diffstat (limited to 'ssl')
-rw-r--r-- | ssl/CMakeLists.txt | 32 |
1 files changed, 29 insertions, 3 deletions
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) | |||
91 | endif() | 91 | endif() |
92 | set_target_properties(ssl PROPERTIES | 92 | set_target_properties(ssl PROPERTIES |
93 | OUTPUT_NAME ssl${SSL_POSTFIX} | 93 | OUTPUT_NAME ssl${SSL_POSTFIX} |
94 | ARCHIVE_OUTPUT_NAME ssl${SSL_POSTFIX}) | 94 | ARCHIVE_OUTPUT_NAME ssl${SSL_POSTFIX} |
95 | set_target_properties(ssl PROPERTIES VERSION ${SSL_VERSION} | 95 | EXPORT_NAME SSL |
96 | SOVERSION ${SSL_MAJOR_VERSION}) | 96 | VERSION ${SSL_VERSION} |
97 | SOVERSION ${SSL_MAJOR_VERSION} | ||
98 | ) | ||
99 | |||
100 | target_include_directories( | ||
101 | ssl | ||
102 | PUBLIC | ||
103 | $<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include> | ||
104 | $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}> | ||
105 | ) | ||
106 | |||
107 | install( | ||
108 | TARGETS ssl | ||
109 | EXPORT SSL-target | ||
110 | ) | ||
111 | |||
112 | export( | ||
113 | EXPORT SSL-target | ||
114 | FILE "${LibreSSL_BINARY_DIR}/LibreSSL-SSL.cmake" | ||
115 | NAMESPACE LibreSSL:: | ||
116 | ) | ||
97 | 117 | ||
98 | if(ENABLE_LIBRESSL_INSTALL) | 118 | if(ENABLE_LIBRESSL_INSTALL) |
99 | install( | 119 | install( |
@@ -102,6 +122,12 @@ if(ENABLE_LIBRESSL_INSTALL) | |||
102 | LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} | 122 | LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} |
103 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} | 123 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} |
104 | ) | 124 | ) |
125 | install( | ||
126 | EXPORT SSL-target | ||
127 | FILE "LibreSSL-SSL.cmake" | ||
128 | NAMESPACE LibreSSL:: | ||
129 | DESTINATION "${LIBRESSL_INSTALL_CMAKEDIR}/LibreSSL" | ||
130 | ) | ||
105 | endif(ENABLE_LIBRESSL_INSTALL) | 131 | endif(ENABLE_LIBRESSL_INSTALL) |
106 | 132 | ||
107 | # build static library for regression test | 133 | # build static library for regression test |