aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'README.md')
-rw-r--r--README.md51
1 files changed, 51 insertions, 0 deletions
diff --git a/README.md b/README.md
index 9660cdc..2b45fc0 100644
--- a/README.md
+++ b/README.md
@@ -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
158Make 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
161set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake;${CMAKE_MODULE_PATH}")
162```
163
164After your **add_executable** or **add_library** line in your CMakeLists.txt file add the following:
165
166```cmake
167find_package(LibreSSL REQUIRED)
168```
169
170It 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
176If 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
179target_link_libraries(test LibreSSL::TLS)
180```
181
182Full example:
183
184```cmake
185cmake_minimum_required(VERSION 3.10.0)
186
187set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake;${CMAKE_MODULE_PATH}")
188
189project(test)
190
191add_executable(test Main.cpp)
192
193find_package(LibreSSL REQUIRED)
194
195target_link_libraries(test LibreSSL::TLS)
196```
197
198#### Linux ####
199
200Following 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
204Placing 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.