-
Notifications
You must be signed in to change notification settings - Fork 16
/
CMakeLists.txt
71 lines (62 loc) · 2.52 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
cmake_minimum_required(VERSION 3.0.2)
project(eIDClientCore)
option(RebuildOpenSSL "Rebuild OpenSSL" ON)
include(ExternalProject)
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMake-Modules)
set(BUILD_DIR ${CMAKE_SOURCE_DIR}/build)
set(CMAKE_INSTALL_PREFIX ${CMAKE_SOURCE_DIR}/build)
set(CMAKE_PREFIX_PATH ${CMAKE_SOURCE_DIR}/build)
ExternalProject_Add(libcryptopp
GIT_REPOSITORY https://github.com/weidai11/cryptopp
PREFIX ${BUILD_DIR}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
)
#ASN1C does not use cmake
set(ASN1C_DOWNLOAD_DIR ${BUILD_DIR}/src/asn1c)
ExternalProject_Add(asn1c
URL https://lionet.info/soft/asn1c-0.9.24.tar.gz
PREFIX ${BUILD_DIR}
CONFIGURE_COMMAND ${ASN1C_DOWNLOAD_DIR}/configure --prefix=${BUILD_DIR}
BUILD_IN_SOURCE 1
BUILD_COMMAND make -C ${ASN1C_DOWNLOAD_DIR}
INSTALL_COMMAND make -C ${ASN1C_DOWNLOAD_DIR} install
)
ExternalProject_Add(libexpat
URL http://sourceforge.net/projects/expat/files/expat/2.1.0/expat-2.1.0.tar.gz
URL_HASH SHA1=b08197d146930a5543a7b99e871cba3da614f6f0
PREFIX ${BUILD_DIR}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
)
#OpenSSL does not use cmake
set(OPENSSL_DOWNLOAD_DIR ${BUILD_DIR}/src/openssl)
if(RebuildOpenSSL)
set(OPENSSL_BUILD_COMMAND make -C ${OPENSSL_DOWNLOAD_DIR} depend && )
message("RebuildOpenSSL switched on. To disable, use cmake -DRebuildOpenSSL=OFF")
else()
message("RebuildOpenSSL switched off. To enable, use cmake -DRebuildOpenSSL=ON")
endif()
set(OPENSSL_BUILD_COMMAND ${OPENSSL_BUILD_COMMAND} make -C ${OPENSSL_DOWNLOAD_DIR})
ExternalProject_Add(openssl
GIT_REPOSITORY https://github.com/misery/openssl
GIT_TAG OpenSSL_1_0_2-stable
PREFIX ${BUILD_DIR}
CONFIGURE_COMMAND ${OPENSSL_DOWNLOAD_DIR}/config --prefix=${BUILD_DIR} shared
BUILD_IN_SOURCE 1
BUILD_COMMAND ${OPENSSL_BUILD_COMMAND}
INSTALL_COMMAND make -C ${OPENSSL_DOWNLOAD_DIR} install_sw
TEST_AFTER_INSTALL 1
TEST_COMMAND ${BUILD_DIR}/bin/openssl ciphers -v | grep RSAPSK
)
ExternalProject_Add(libcurl
URL https://github.com/bagder/curl/releases/download/curl-7_44_0/curl-7.44.0.tar.gz
PREFIX ${BUILD_DIR}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}
)
add_dependencies(libcurl openssl)
ExternalProject_Add(eIDClientCore
DOWNLOAD_COMMAND ""
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/eIDClientCore
PREFIX ${BUILD_DIR}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} -DCMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}
)
add_dependencies(eIDClientCore libcryptopp asn1c libexpat openssl libcurl)