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 -Wwrite-strings -fPIC
25)
26if("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
27    add_compile_options(
28        -Wunsafe-loop-optimizations
29    )
30endif()
31if(CFG_WERROR)
32    add_compile_options(-Werror)
33endif(CFG_WERROR)
34
35find_program(CCACHE_FOUND ccache)
36if(CCACHE_FOUND)
37    set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
38    set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
39endif(CCACHE_FOUND)
40
41add_subdirectory(libteec)
42add_subdirectory(tee-supplicant)
43add_subdirectory(libckteec)
44if(WITH_TEEACL)
45    find_package(PkgConfig REQUIRED)
46    pkg_check_modules(uuid REQUIRED IMPORTED_TARGET uuid)
47    add_subdirectory(libteeacl)
48endif(WITH_TEEACL)
49add_subdirectory(libseteec)
50