comparison OrthancFramework/Resources/CMake/LibP11Configuration.cmake @ 4044:d25f4c0fa160 framework

splitting code into OrthancFramework and OrthancServer
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 10 Jun 2020 20:30:34 +0200
parents Resources/CMake/LibP11Configuration.cmake@0c2a8d5e0097
children 9fa06bddaabe
comparison
equal deleted inserted replaced
4043:6c6239aec462 4044:d25f4c0fa160
1 if (STATIC_BUILD OR NOT USE_SYSTEM_LIBP11)
2 SET(LIBP11_SOURCES_DIR ${CMAKE_BINARY_DIR}/libp11-0.4.0)
3 SET(LIBP11_URL "http://orthanc.osimis.io/ThirdPartyDownloads/libp11-0.4.0.tar.gz")
4 SET(LIBP11_MD5 "00b3e41db5be840d822bda12f3ab2ca7")
5
6 if (IS_DIRECTORY "${LIBP11_SOURCES_DIR}")
7 set(FirstRun OFF)
8 else()
9 set(FirstRun ON)
10 endif()
11
12 DownloadPackage(${LIBP11_MD5} ${LIBP11_URL} "${LIBP11_SOURCES_DIR}")
13
14 # Apply the patches
15 execute_process(
16 COMMAND ${PATCH_EXECUTABLE} -p0 -N -i ${CMAKE_CURRENT_SOURCE_DIR}/Resources/Patches/libp11-0.4.0.patch
17 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
18 RESULT_VARIABLE Failure
19 )
20
21 if (Failure AND FirstRun)
22 message(FATAL_ERROR "Error while patching libp11")
23 endif()
24
25 # This command MUST be after applying the patch
26 file(COPY
27 ${LIBP11_SOURCES_DIR}/src/engine.h
28 ${LIBP11_SOURCES_DIR}/src/libp11.h
29 DESTINATION ${AUTOGENERATED_DIR}/libp11)
30
31 set(LIBP11_SOURCES
32 #${LIBP11_SOURCES_DIR}/src/eng_front.c
33 ${LIBP11_SOURCES_DIR}/src/eng_back.c
34 ${LIBP11_SOURCES_DIR}/src/eng_parse.c
35 ${LIBP11_SOURCES_DIR}/src/libpkcs11.c
36 ${LIBP11_SOURCES_DIR}/src/p11_attr.c
37 ${LIBP11_SOURCES_DIR}/src/p11_cert.c
38 ${LIBP11_SOURCES_DIR}/src/p11_ec.c
39 ${LIBP11_SOURCES_DIR}/src/p11_err.c
40 ${LIBP11_SOURCES_DIR}/src/p11_front.c
41 ${LIBP11_SOURCES_DIR}/src/p11_key.c
42 ${LIBP11_SOURCES_DIR}/src/p11_load.c
43 ${LIBP11_SOURCES_DIR}/src/p11_misc.c
44 ${LIBP11_SOURCES_DIR}/src/p11_rsa.c
45 ${LIBP11_SOURCES_DIR}/src/p11_slot.c
46 )
47
48 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR
49 ${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD" OR
50 ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" OR
51 ${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD" OR
52 ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
53 list(APPEND LIBP11_SOURCES
54 ${LIBP11_SOURCES_DIR}/src/atfork.c
55 )
56 endif()
57
58 source_group(ThirdParty\\libp11 REGULAR_EXPRESSION ${LIBP11_SOURCES_DIR}/.*)
59
60 else()
61 check_include_file_cxx(libp11.h HAVE_LIBP11_H)
62 if (NOT HAVE_LIBP11_H)
63 message(FATAL_ERROR "Please install the libp11-dev package")
64 endif()
65
66 check_library_exists(p11 PKCS11_login "" HAVE_LIBP11_LIB)
67 if (NOT HAVE_LIBP11_LIB)
68 message(FATAL_ERROR "Please install the libp11-dev package")
69 endif()
70
71 link_libraries(p11)
72 endif()