Mercurial > hg > orthanc-databases
annotate Resources/Orthanc/CMake/OpenSslConfiguration.cmake @ 459:ecd0b719cff5
update year to 2024
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 24 Jan 2024 15:25:48 +0100 |
parents | e25f4500b531 |
children | 54d518dcd74a |
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 |
459
ecd0b719cff5
update year to 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
409
diff
changeset
|
4 # Copyright (C) 2017-2024 Osimis S.A., Belgium |
ecd0b719cff5
update year to 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
409
diff
changeset
|
5 # 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
|
6 # |
e25f4500b531
fix linking against system-wide Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
7 # 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
|
8 # 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
|
9 # 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
|
10 # 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
|
11 # |
e25f4500b531
fix linking against system-wide Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
12 # 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
|
13 # 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
|
14 # 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
|
15 # Lesser General Public License for more details. |
e25f4500b531
fix linking against system-wide Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
16 # |
e25f4500b531
fix linking against system-wide Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
17 # 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
|
18 # 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
|
19 # <http://www.gnu.org/licenses/>. |
e25f4500b531
fix linking against system-wide Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
20 |
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 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
|
23 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
|
24 # 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
|
25 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
|
26 elseif (OPENSSL_STATIC_VERSION STREQUAL "3.0") |
e25f4500b531
fix linking against system-wide Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
27 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
|
28 else() |
e25f4500b531
fix linking against system-wide Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
29 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
|
30 endif() |
e25f4500b531
fix linking against system-wide Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
31 |
e25f4500b531
fix linking against system-wide Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
32 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
|
33 |
e25f4500b531
fix linking against system-wide Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
34 elseif (CMAKE_CROSSCOMPILING AND |
e25f4500b531
fix linking against system-wide Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
35 "${CMAKE_SYSTEM_VERSION}" STREQUAL "CrossToolNg") |
e25f4500b531
fix linking against system-wide Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
36 |
e25f4500b531
fix linking against system-wide Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
37 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
|
38 if (NOT HAVE_OPENSSL_H) |
e25f4500b531
fix linking against system-wide Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
39 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
|
40 endif() |
e25f4500b531
fix linking against system-wide Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
41 |
e25f4500b531
fix linking against system-wide Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
42 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
|
43 if (NOT HAVE_OPENSSL_CRYPTO_LIB) |
e25f4500b531
fix linking against system-wide Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
44 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
|
45 endif() |
e25f4500b531
fix linking against system-wide Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
46 |
e25f4500b531
fix linking against system-wide Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
47 # 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
|
48 # "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
|
49 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
|
50 if (NOT HAVE_OPENSSL_SSL_LIB) |
e25f4500b531
fix linking against system-wide Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
51 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
|
52 if (NOT HAVE_OPENSSL_SSL_LIB_2) |
e25f4500b531
fix linking against system-wide Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
53 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
|
54 endif() |
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 |
e25f4500b531
fix linking against system-wide Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
57 link_libraries(crypto ssl) |
e25f4500b531
fix linking against system-wide Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
58 |
e25f4500b531
fix linking against system-wide Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
59 else() |
e25f4500b531
fix linking against system-wide Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
60 include(FindOpenSSL) |
e25f4500b531
fix linking against system-wide Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
61 |
e25f4500b531
fix linking against system-wide Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
62 if (NOT OPENSSL_FOUND) |
e25f4500b531
fix linking against system-wide Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
63 message(FATAL_ERROR "Unable to find OpenSSL") |
e25f4500b531
fix linking against system-wide Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
64 endif() |
e25f4500b531
fix linking against system-wide Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
65 |
e25f4500b531
fix linking against system-wide Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
66 include_directories(${OPENSSL_INCLUDE_DIR}) |
e25f4500b531
fix linking against system-wide Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
67 link_libraries(${OPENSSL_LIBRARIES}) |
e25f4500b531
fix linking against system-wide Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
68 endif() |