annotate OrthancFramework/Resources/CMake/LibP11Configuration.cmake @ 5433:38403e13c1ca

cont
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 21 Nov 2023 18:22:49 +0100
parents c5f243ad7103
children aa1c09fa6632
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
5185
0ea402b4d901 upgrade to year 2023
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4870
diff changeset
4 # Copyright (C) 2017-2023 Osimis S.A., Belgium
0ea402b4d901 upgrade to year 2023
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4870
diff changeset
5 # Copyright (C) 2021-2023 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
4120
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4052
diff changeset
6 #
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4052
diff changeset
7 # 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
8 # 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
9 # 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
10 # the License, or (at your option) any later version.
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4052
diff changeset
11 #
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4052
diff changeset
12 # 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
13 # WITHOUT ANY WARRANTY; without even the implied warranty of
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4052
diff changeset
14 # 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
15 # Lesser General Public License for more details.
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4052
diff changeset
16 #
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4052
diff changeset
17 # 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
18 # License along with this program. If not, see
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4052
diff changeset
19 # <http://www.gnu.org/licenses/>.
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4052
diff changeset
20
304842a0d152 adding missing license headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4052
diff changeset
21
2025
e7e1858d9504 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2024
diff changeset
22 if (STATIC_BUILD OR NOT USE_SYSTEM_LIBP11)
4052
9fa06bddaabe fix p11
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
23 if (NOT STATIC_BUILD AND USE_SYSTEM_OPENSSL)
9fa06bddaabe fix p11
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
24 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
25 endif()
9fa06bddaabe fix p11
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
26
2025
e7e1858d9504 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2024
diff changeset
27 SET(LIBP11_SOURCES_DIR ${CMAKE_BINARY_DIR}/libp11-0.4.0)
5271
c5f243ad7103 switch third party downloads to UCLouvain which provides faster network
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5185
diff changeset
28 SET(LIBP11_URL "https://orthanc.uclouvain.be/third-party-downloads/libp11-0.4.0.tar.gz")
2025
e7e1858d9504 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2024
diff changeset
29 SET(LIBP11_MD5 "00b3e41db5be840d822bda12f3ab2ca7")
2026
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2025
diff changeset
30
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2025
diff changeset
31 if (IS_DIRECTORY "${LIBP11_SOURCES_DIR}")
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2025
diff changeset
32 set(FirstRun OFF)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2025
diff changeset
33 else()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2025
diff changeset
34 set(FirstRun ON)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2025
diff changeset
35 endif()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2025
diff changeset
36
2025
e7e1858d9504 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2024
diff changeset
37 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
38
2027
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2026
diff changeset
39 # Apply the patches
2026
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2025
diff changeset
40 execute_process(
4052
9fa06bddaabe fix p11
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
41 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
42 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2025
diff changeset
43 RESULT_VARIABLE Failure
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2025
diff changeset
44 )
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2025
diff changeset
45
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2025
diff changeset
46 if (Failure AND FirstRun)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2025
diff changeset
47 message(FATAL_ERROR "Error while patching libp11")
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2025
diff changeset
48 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
49
2027
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2026
diff changeset
50 # This command MUST be after applying the patch
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2026
diff changeset
51 file(COPY
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2026
diff changeset
52 ${LIBP11_SOURCES_DIR}/src/engine.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2026
diff changeset
53 ${LIBP11_SOURCES_DIR}/src/libp11.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2026
diff changeset
54 DESTINATION ${AUTOGENERATED_DIR}/libp11)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2026
diff changeset
55
4052
9fa06bddaabe fix p11
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
56 file(WRITE ${AUTOGENERATED_DIR}/libp11/config.h "")
9fa06bddaabe fix p11
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
57
2022
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58 set(LIBP11_SOURCES
2025
e7e1858d9504 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2024
diff changeset
59 #${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
60 ${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
61 ${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
62 ${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
63 ${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
64 ${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
65 ${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
66 ${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
67 ${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
68 ${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
69 ${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
70 ${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
71 ${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
72 ${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
73 )
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 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
76 ${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
77 ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" OR
2364
ae50eccd41b7 compilation succeeds on OpenBSD
jodogne
parents: 2187
diff changeset
78 ${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
79 ${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
80 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
81 ${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
82 )
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83 endif()
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84
2113
0108ac01fc8e added source_group directives for MSVC
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2027
diff changeset
85 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
86
2022
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
87 else()
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
88 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
89 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
90 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
91 endif()
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
92
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
93 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
94 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
95 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
96 endif()
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97
fefbe71c2272 Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98 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
99 endif()