-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
104 lines (88 loc) · 3.44 KB
/
CMakeLists.txt
File metadata and controls
104 lines (88 loc) · 3.44 KB
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
cmake_minimum_required(VERSION 3.13.0)
include(CheckIncludeFile)
project(SymCrypt-OpenSSL
VERSION 1.10.0
DESCRIPTION "The SymCrypt engine and provider for OpenSSL (SCOSSL)"
HOMEPAGE_URL "https://github.com/microsoft/SymCrypt-OpenSSL")
set(SYMCRYPT_MINIMUM_MAJOR "103")
set(SYMCRYPT_MINIMUM_MINOR "8")
find_package(OpenSSL REQUIRED)
if (SYMCRYPT_ROOT_DIR)
set(SYMCRYPT_FOUND TRUE)
include_directories(${SYMCRYPT_ROOT_DIR}/inc)
else()
# Try to load SymCrypt from pkg-config
find_package(PkgConfig)
if (PKG_CONFIG_FOUND)
pkg_check_modules(SYMCRYPT symcrypt>=${SYMCRYPT_MINIMUM_MAJOR}.${SYMCRYPT_MINIMUM_MINOR})
if (SYMCRYPT_FOUND)
message(STATUS "SymCrypt Includes: ${SYMCRYPT_INCLUDE_DIRS}")
include_directories(${SYMCRYPT_INCLUDE_DIRS})
endif()
endif()
# Try to find installed SymCrypt
if (NOT SYMCRYPT_FOUND)
find_file(SYMCRYPT_HEADER "symcrypt.h" PATHS ${CMAKE_SOURCE_DIR})
# SymCrypt headers required for all projects, including KeysInUse
if (NOT SYMCRYPT_HEADER)
message(FATAL_ERROR "SymCrypt header file not found. Please set SYMCRYPT_ROOT_DIR or install SymCrypt headers.")
endif()
find_library(SYMCRYPT_LIBRARY symcrypt PATHS ${CMAKE_SOURCE_DIR})
if (SYMCRYPT_LIBRARY)
set(SYMCRYPT_FOUND TRUE)
message(STATUS "Found installed SymCrypt library: ${SYMCRYPT_LIBRARY}")
else()
message(WARNING "SymCrypt library not found. Only KeysInUse will be built. Please set SYMCRYPT_ROOT_DIR or install SymCrypt library.")
endif()
endif()
endif()
if (KEYSINUSE_LOG_SYSLOG)
find_package(PkgConfig)
if (PKG_CONFIG_FOUND)
pkg_check_modules(SYSTEMD libsystemd)
endif()
# Try to find installed libsystemd
if (NOT SYSTEMD_FOUND)
find_file(SYSTEMD_HEADER "systemd/sd-journal.h" PATHS ${CMAKE_SOURCE_DIR})
if (NOT SYSTEMD_HEADER)
message(FATAL_ERROR "systemd/sd-journal.h not found. Please install libsystemd headers.")
endif()
endif()
find_library(SYSTEMD_LIBRARY systemd PATHS ${CMAKE_SOURCE_DIR})
if (SYSTEMD_LIBRARY)
message(STATUS "Found installed Systemd library: ${SYSTEMD_LIBRARY}")
else()
message(WARNING "Systemd library not found. Please install libsystemd.")
endif()
endif()
# In Sanitize version, enable sanitizers
if (CMAKE_BUILD_TYPE MATCHES Sanitize)
add_compile_options(-fsanitize=address)
add_compile_options(-fsanitize=leak)
add_compile_options(-fsanitize=undefined)
add_compile_options(-fno-sanitize-recover=all)
add_link_options(-fsanitize=address)
add_link_options(-fsanitize=leak)
add_link_options(-fsanitize=undefined)
add_link_options(-fno-sanitize-recover=all)
endif()
if (CMAKE_BUILD_TYPE MATCHES Release|RelWithDebInfo)
message("Release mode")
else()
message("Debug mode")
add_compile_options(-DDBG=1)
endif()
if (SYMCRYPT_FOUND AND NOT KEYSINUSE_STANDALONE)
add_subdirectory (ScosslCommon)
add_subdirectory (SymCryptEngine/static)
add_subdirectory (SymCryptEngine/dynamic)
add_subdirectory (test/SslPlay)
if (${OPENSSL_VERSION} VERSION_GREATER_EQUAL 3)
add_subdirectory (SymCryptProvider)
endif()
endif()
# SymCrypt not needed for just building the KeysInUse standalone library and test
add_subdirectory (KeysInUse)
if (KEYSINUSE_ENABLED OR KEYSINUSE_STANDALONE)
add_subdirectory (test/KeysInUseTest)
endif()