forked from openenclave/openenclave
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
35 lines (29 loc) · 1.18 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
# Copyright (c) Open Enclave SDK contributors.
# Licensed under the MIT License.
# Use the edger8r to generate C bindings from the EDL file.
add_custom_command(
OUTPUT helloworld_t.h helloworld_t.c helloworld_args.h
DEPENDS ${CMAKE_SOURCE_DIR}/helloworld.edl
COMMAND
openenclave::oeedger8r --trusted ${CMAKE_SOURCE_DIR}/helloworld.edl
--search-path ${OE_INCLUDEDIR} --search-path
${OE_INCLUDEDIR}/openenclave/edl/sgx)
add_executable(enclave enc.c ${CMAKE_CURRENT_BINARY_DIR}/helloworld_t.c)
if (WIN32)
maybe_build_using_clangw(enclave)
endif ()
target_compile_definitions(enclave PUBLIC OE_API_VERSION=2)
# Need for the generated file helloworld_t.h
target_include_directories(enclave PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
if (LVI_MITIGATION MATCHES ControlFlow)
# Helper to enable compiler options for LVI mitigation.
apply_lvi_mitigation(enclave)
# Link against LVI-mitigated libraries.
target_link_libraries(
enclave openenclave::oeenclave-lvi-cfg
openenclave::oecrypto${OE_CRYPTO_LIB}-lvi-cfg openenclave::oelibc-lvi-cfg)
else ()
target_link_libraries(
enclave openenclave::oeenclave openenclave::oecrypto${OE_CRYPTO_LIB}
openenclave::oelibc)
endif ()