annotate OrthancFramework/Resources/CMake/LibP11Configuration.cmake @ 5640:f7adfb22e20e

updated copyright, as Orthanc Team now replaces Osimis
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 30 May 2024 21:19:57 +0200
parents 48b8dae6dc77
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4120
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4052
diff changeset
1 # Orthanc - A Lightweight, RESTful DICOM Store
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4052
diff changeset
2 # Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4052
diff changeset
3 # Department, University Hospital of Liege, Belgium
5640
f7adfb22e20e updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5485
diff changeset
4 # Copyright (C) 2017-2023 Osimis S.A., Belgium
f7adfb22e20e updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5485
diff changeset
5 # Copyright (C) 2024-2024 Orthanc Team SRL, Belgium
5485
48b8dae6dc77 upgrade to year 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5434
diff changeset
6 # Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
4120
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4052
diff changeset
7 #
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4052
diff changeset
8 # This program is free software: you can redistribute it and/or
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4052
diff changeset
9 # modify it under the terms of the GNU Lesser General Public License
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4052
diff changeset
10 # as published by the Free Software Foundation, either version 3 of
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4052
diff changeset
11 # the License, or (at your option) any later version.
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4052
diff changeset
12 #
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4052
diff changeset
13 # This program is distributed in the hope that it will be useful, but
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4052
diff changeset
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4052
diff changeset
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4052
diff changeset
16 # Lesser General Public License for more details.
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4052
diff changeset
17 #
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4052
diff changeset
18 # You should have received a copy of the GNU Lesser General Public
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4052
diff changeset
19 # License along with this program. If not, see
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4052
diff changeset
20 # <http://www.gnu.org/licenses/>.
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4052
diff changeset
21
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4052
diff changeset
22
2025
e7e1858d9504 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2024
diff changeset
23 if (STATIC_BUILD OR NOT USE_SYSTEM_LIBP11)
4052
9fa06bddaabe fix p11
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
24 if (NOT STATIC_BUILD AND USE_SYSTEM_OPENSSL)
9fa06bddaabe fix p11
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
25 message(FATAL_ERROR "If statically linking against libp11, one must also statically link against OpenSSL")
9fa06bddaabe fix p11
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
26 endif()
9fa06bddaabe fix p11
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
27
2025
e7e1858d9504 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2024
diff changeset
28 SET(LIBP11_SOURCES_DIR ${CMAKE_BINARY_DIR}/libp11-0.4.0)
5434
aa1c09fa6632 changed location of third-party downloads
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5271
diff changeset
29 SET(LIBP11_URL "https://orthanc.uclouvain.be/downloads/third-party-downloads/libp11-0.4.0.tar.gz")
2025
e7e1858d9504 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2024
diff changeset
30 SET(LIBP11_MD5 "00b3e41db5be840d822bda12f3ab2ca7")
2026
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2025
diff changeset
31
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2025
diff changeset
32 if (IS_DIRECTORY "${LIBP11_SOURCES_DIR}")
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2025
diff changeset
33 set(FirstRun OFF)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2025
diff changeset
34 else()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2025
diff changeset
35 set(FirstRun ON)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2025
diff changeset
36 endif()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2025
diff changeset
37
2025
e7e1858d9504 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2024
diff changeset
38 DownloadPackage(${LIBP11_MD5} ${LIBP11_URL} "${LIBP11_SOURCES_DIR}")
2022
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39
2027
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2026
diff changeset
40 # Apply the patches
2026
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2025
diff changeset
41 execute_process(
4052
9fa06bddaabe fix p11
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
42 COMMAND ${PATCH_EXECUTABLE} -p0 -N -i ${CMAKE_CURRENT_LIST_DIR}/../Patches/libp11-0.4.0.patch
2026
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2025
diff changeset
43 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2025
diff changeset
44 RESULT_VARIABLE Failure
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2025
diff changeset
45 )
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2025
diff changeset
46
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2025
diff changeset
47 if (Failure AND FirstRun)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2025
diff changeset
48 message(FATAL_ERROR "Error while patching libp11")
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2025
diff changeset
49 endif()
2022
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50
2027
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2026
diff changeset
51 # This command MUST be after applying the patch
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2026
diff changeset
52 file(COPY
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2026
diff changeset
53 ${LIBP11_SOURCES_DIR}/src/engine.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2026
diff changeset
54 ${LIBP11_SOURCES_DIR}/src/libp11.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2026
diff changeset
55 DESTINATION ${AUTOGENERATED_DIR}/libp11)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2026
diff changeset
56
4052
9fa06bddaabe fix p11
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
57 file(WRITE ${AUTOGENERATED_DIR}/libp11/config.h "")
9fa06bddaabe fix p11
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
58
2022
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 set(LIBP11_SOURCES
2025
e7e1858d9504 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2024
diff changeset
60 #${LIBP11_SOURCES_DIR}/src/eng_front.c
2022
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61 ${LIBP11_SOURCES_DIR}/src/eng_back.c
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62 ${LIBP11_SOURCES_DIR}/src/eng_parse.c
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63 ${LIBP11_SOURCES_DIR}/src/libpkcs11.c
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64 ${LIBP11_SOURCES_DIR}/src/p11_attr.c
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 ${LIBP11_SOURCES_DIR}/src/p11_cert.c
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66 ${LIBP11_SOURCES_DIR}/src/p11_ec.c
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67 ${LIBP11_SOURCES_DIR}/src/p11_err.c
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68 ${LIBP11_SOURCES_DIR}/src/p11_front.c
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69 ${LIBP11_SOURCES_DIR}/src/p11_key.c
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70 ${LIBP11_SOURCES_DIR}/src/p11_load.c
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71 ${LIBP11_SOURCES_DIR}/src/p11_misc.c
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72 ${LIBP11_SOURCES_DIR}/src/p11_rsa.c
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73 ${LIBP11_SOURCES_DIR}/src/p11_slot.c
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74 )
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77 ${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD" OR
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78 ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" OR
2364
ae50eccd41b7 compilation succeeds on OpenBSD
jodogne
parents: 2187
diff changeset
79 ${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD" OR
2022
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
80 ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
81 list(APPEND LIBP11_SOURCES
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82 ${LIBP11_SOURCES_DIR}/src/atfork.c
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83 )
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84 endif()
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85
2113
0108ac01fc8e added source_group directives for MSVC
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2027
diff changeset
86 source_group(ThirdParty\\libp11 REGULAR_EXPRESSION ${LIBP11_SOURCES_DIR}/.*)
0108ac01fc8e added source_group directives for MSVC
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2027
diff changeset
87
2022
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
88 else()
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
89 check_include_file_cxx(libp11.h HAVE_LIBP11_H)
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90 if (NOT HAVE_LIBP11_H)
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91 message(FATAL_ERROR "Please install the libp11-dev package")
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
92 endif()
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
93
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
94 check_library_exists(p11 PKCS11_login "" HAVE_LIBP11_LIB)
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
95 if (NOT HAVE_LIBP11_LIB)
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96 message(FATAL_ERROR "Please install the libp11-dev package")
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97 endif()
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99 link_libraries(p11)
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
100 endif()