1cmake_minimum_required (VERSION 3.4)
2project (optee_client C)
3
4# https://cmake.org/Wiki/CMake_Useful_Variables
5set (CMAKE_TOOLCHAIN_FILE CMakeToolchain.txt)
6
7option (CFG_WERROR "Build with -Werror" TRUE)
8option (WITH_TEEACL "Build libteeacl" TRUE)
9
10include(GNUInstallDirs)
11
12################################################################################
13# Compiler flags:
14#   We want to use the same flags in the entire optee_client git
15################################################################################
16add_compile_options (
17	-Wall -Wbad-function-cast -Wcast-align
18	-Werror-implicit-function-declaration -Wextra
19	-Wfloat-equal -Wformat-nonliteral -Wformat-security
20	-Wformat=2 -Winit-self -Wmissing-declarations
21	-Wmissing-format-attribute -Wmissing-include-dirs
22	-Wmissing-noreturn -Wmissing-prototypes -Wnested-externs
23	-Wpointer-arith -Wshadow -Wstrict-prototypes
24	-Wswitch-default -Wunsafe-loop-optimizations
25	-Wwrite-strings -fPIC
26)
27if(CFG_WERROR)
28    add_compile_options(-Werror)
29endif(CFG_WERROR)
30
31find_program(CCACHE_FOUND ccache)
32if(CCACHE_FOUND)
33    set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
34    set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
35endif(CCACHE_FOUND)
36
37add_subdirectory (libteec)
38add_subdirectory (tee-supplicant)
39add_subdirectory (public)
40add_subdirectory (libckteec)
41if(WITH_TEEACL)
42    find_package (PkgConfig REQUIRED)
43    pkg_check_modules(uuid REQUIRED IMPORTED_TARGET uuid)
44    add_subdirectory (libteeacl)
45endif(WITH_TEEACL)
46add_subdirectory (libseteec)
47