Mercurial > hg > orthanc-databases
comparison Resources/Orthanc/CMake/OpenSslConfiguration.cmake @ 409:e25f4500b531
fix linking against system-wide Orthanc framework
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Sat, 15 Apr 2023 14:55:21 +0200 |
parents | |
children | ecd0b719cff5 |
comparison
equal
deleted
inserted
replaced
407:ca6dc9bb8b79 | 409:e25f4500b531 |
---|---|
1 # Orthanc - A Lightweight, RESTful DICOM Store | |
2 # Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
3 # Department, University Hospital of Liege, Belgium | |
4 # Copyright (C) 2017-2023 Osimis S.A., Belgium | |
5 # Copyright (C) 2021-2023 Sebastien Jodogne, ICTEAM UCLouvain, Belgium | |
6 # | |
7 # This program is free software: you can redistribute it and/or | |
8 # modify it under the terms of the GNU Lesser General Public License | |
9 # as published by the Free Software Foundation, either version 3 of | |
10 # the License, or (at your option) any later version. | |
11 # | |
12 # This program is distributed in the hope that it will be useful, but | |
13 # WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 # Lesser General Public License for more details. | |
16 # | |
17 # You should have received a copy of the GNU Lesser General Public | |
18 # License along with this program. If not, see | |
19 # <http://www.gnu.org/licenses/>. | |
20 | |
21 | |
22 if (STATIC_BUILD OR NOT USE_SYSTEM_OPENSSL) | |
23 if (OPENSSL_STATIC_VERSION STREQUAL "1.1.1") | |
24 # Still used by orthanc-gcp (Google Cloud Platform) as of its release 1.0 | |
25 include(${CMAKE_CURRENT_LIST_DIR}/OpenSslConfigurationStatic-1.1.1.cmake) | |
26 elseif (OPENSSL_STATIC_VERSION STREQUAL "3.0") | |
27 include(${CMAKE_CURRENT_LIST_DIR}/OpenSslConfigurationStatic-3.0.cmake) | |
28 else() | |
29 message(FATAL_ERROR "Unsupported version of OpenSSL: ${OPENSSL_STATIC_VERSION}") | |
30 endif() | |
31 | |
32 source_group(ThirdParty\\OpenSSL REGULAR_EXPRESSION ${OPENSSL_SOURCES_DIR}/.*) | |
33 | |
34 elseif (CMAKE_CROSSCOMPILING AND | |
35 "${CMAKE_SYSTEM_VERSION}" STREQUAL "CrossToolNg") | |
36 | |
37 CHECK_INCLUDE_FILE_CXX(openssl/opensslv.h HAVE_OPENSSL_H) | |
38 if (NOT HAVE_OPENSSL_H) | |
39 message(FATAL_ERROR "Please install the libopenssl-dev package") | |
40 endif() | |
41 | |
42 CHECK_LIBRARY_EXISTS(crypto "OPENSSL_init" "" HAVE_OPENSSL_CRYPTO_LIB) | |
43 if (NOT HAVE_OPENSSL_CRYPTO_LIB) | |
44 message(FATAL_ERROR "Please install the libopenssl package") | |
45 endif() | |
46 | |
47 # The "SSL_library_init" is for OpenSSL <= 1.0.2, whereas | |
48 # "OPENSSL_init_ssl" is for OpenSSL >= 1.1.0 | |
49 CHECK_LIBRARY_EXISTS(ssl "SSL_library_init" "" HAVE_OPENSSL_SSL_LIB) | |
50 if (NOT HAVE_OPENSSL_SSL_LIB) | |
51 CHECK_LIBRARY_EXISTS(ssl "OPENSSL_init_ssl" "" HAVE_OPENSSL_SSL_LIB_2) | |
52 if (NOT HAVE_OPENSSL_SSL_LIB_2) | |
53 message(FATAL_ERROR "Please install the libopenssl package") | |
54 endif() | |
55 endif() | |
56 | |
57 link_libraries(crypto ssl) | |
58 | |
59 else() | |
60 include(FindOpenSSL) | |
61 | |
62 if (NOT OPENSSL_FOUND) | |
63 message(FATAL_ERROR "Unable to find OpenSSL") | |
64 endif() | |
65 | |
66 include_directories(${OPENSSL_INCLUDE_DIR}) | |
67 link_libraries(${OPENSSL_LIBRARIES}) | |
68 endif() |