-
Notifications
You must be signed in to change notification settings - Fork 8
/
CMakeLists.txt
82 lines (65 loc) · 2.04 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
72
73
74
75
76
77
78
79
80
81
82
cmake_minimum_required(VERSION 3.14)
project(authenticode_parser VERSION 1.0.0 LANGUAGES C)
find_package(OpenSSL 1.1.1 REQUIRED)
message(STATUS "SSL library is ${OPENSSL_SSL_LIBRARY}")
message(STATUS "Crypto library is ${OPENSSL_SSL_LIBRARY}")
message(STATUS "All openssl libraries are ${OPENSSL_SSL_LIBRARY}")
message(STATUS "OpenSSL version is ${OPENSSL_SSL_LIBRARY}")
include(GNUInstallDirs)
add_library(authenticode STATIC
src/authenticode.c
src/helper.c
src/structs.c
src/countersignature.c
src/certificate.c
)
include (TestBigEndian)
TEST_BIG_ENDIAN(IS_BIG_ENDIAN)
if(IS_BIG_ENDIAN)
target_compile_definitions(-DWORDS_BIGENDIAN)
endif()
if(MSVC)
target_compile_options(authenticode PRIVATE /W4 -fpie)
else()
target_compile_options(authenticode PRIVATE -Wall -Wextra -Wpedantic -fpie)
endif()
target_compile_features(authenticode PRIVATE c_std_11)
target_include_directories(authenticode
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src
)
target_link_libraries(authenticode
PRIVATE
OpenSSL::Crypto
)
install(
DIRECTORY include/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
install(TARGETS authenticode
EXPORT authenticode-targets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
set(INSTALL_CONFIGDIR ${CMAKE_INSTALL_LIBDIR}/cmake/authenticode)
install(EXPORT authenticode-targets
FILE "authenticode-targets.cmake"
DESTINATION ${INSTALL_CONFIGDIR}
)
include(CMakePackageConfigHelpers)
configure_file(
"authenticode-config.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/authenticode-config.cmake"
@ONLY
)
install(
FILES "${CMAKE_CURRENT_BINARY_DIR}/authenticode-config.cmake"
DESTINATION ${INSTALL_CONFIGDIR}
)
if(BUILD_TESTS)
enable_testing()
add_subdirectory(tests)
endif()