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