annotate OrthancFramework/Resources/CMake/LibP11Configuration.cmake @ 4744:c125632f9468

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