diff options
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 51 |
1 files changed, 51 insertions, 0 deletions
@@ -151,3 +151,54 @@ into other projects or build by itself. | |||
151 | | ENABLE_NC | OFF | Enable installing TLS-enabled nc(1) | | 151 | | ENABLE_NC | OFF | Enable installing TLS-enabled nc(1) | |
152 | | OPENSSLDIR | Blank | Set the default openssl directory. Can be specified from command line using <br>```-DOPENSSLDIR=<dirname>``` | | 152 | | OPENSSLDIR | Blank | Set the default openssl directory. Can be specified from command line using <br>```-DOPENSSLDIR=<dirname>``` | |
153 | 153 | ||
154 | # Using LibreSSL # | ||
155 | |||
156 | ## CMake ## | ||
157 | |||
158 | Make a new folder in your project root (where your main CMakeLists.txt file is located) called CMake. Copy the FindLibreSSL.cmake file to that folder, and add the following line to your main CMakeLists.txt: | ||
159 | |||
160 | ```cmake | ||
161 | set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake;${CMAKE_MODULE_PATH}") | ||
162 | ``` | ||
163 | |||
164 | After your **add_executable** or **add_library** line in your CMakeLists.txt file add the following: | ||
165 | |||
166 | ```cmake | ||
167 | find_package(LibreSSL REQUIRED) | ||
168 | ``` | ||
169 | |||
170 | It will tell CMake to find LibreSSL and if found will let you use the following 3 interfaces in your CMakeLists.txt file: | ||
171 | |||
172 | * LibreSSL::Crypto | ||
173 | * LibreSSL::SSL | ||
174 | * LibreSSL::TLS | ||
175 | |||
176 | If you for example want to use the LibreSSL TLS library in your test program, include it like so (SSL and Cryto are required by TLS and included automatically too): | ||
177 | |||
178 | ```cmake | ||
179 | target_link_libraries(test LibreSSL::TLS) | ||
180 | ``` | ||
181 | |||
182 | Full example: | ||
183 | |||
184 | ```cmake | ||
185 | cmake_minimum_required(VERSION 3.10.0) | ||
186 | |||
187 | set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake;${CMAKE_MODULE_PATH}") | ||
188 | |||
189 | project(test) | ||
190 | |||
191 | add_executable(test Main.cpp) | ||
192 | |||
193 | find_package(LibreSSL REQUIRED) | ||
194 | |||
195 | target_link_libraries(test LibreSSL::TLS) | ||
196 | ``` | ||
197 | |||
198 | #### Linux #### | ||
199 | |||
200 | Following the guide in the sections above to compile LibreSSL using make and running "sudo make install" will install LibreSSL to the /usr/local/ folder, and will found automatically by find_package. If your system installs it to another location or you have placed them yourself in a different location, you can set the CMake variable LIBRESSL_ROOT_DIR to the correct path, to help CMake find the library. | ||
201 | |||
202 | #### Windows #### | ||
203 | |||
204 | Placing the library files in C:/Program Files/LibreSSL/lib and the include files in C:/Program Files/LibreSSL/include should let CMake find them automatically, but it is recommended that you use CMake-GUI to set the paths. It is more convenient as you can have the files in any folder you choose. | ||