blob: 54cb32b246667ea723fd76e8e7c9fc5feccfb62f [file] [log] [blame]
Jens Wiklander7437cb22018-02-08 17:54:30 +01001cmake_minimum_required (VERSION 3.2)
2project (benchmark C)
3
4# Default cross compile settings
5set (CMAKE_TOOLCHAIN_FILE CMakeToolchain.txt)
6
7################################################################################
8# Packages
9################################################################################
10find_package(Threads REQUIRED)
11if(NOT THREADS_FOUND)
12 message(FATAL_ERROR "Threads not found")
13endif()
14
15include(GNUInstallDirs)
16
17################################################################################
18# Compiler flags:
19# We want to use the same flags in the entire optee_client git
20################################################################################
21add_compile_options (
22 -Wall -Wextra -Werror
23# -Wall -Wbad-function-cast -Wcast-align
24# -Werror-implicit-function-declaration -Wextra
25# -Wfloat-equal -Wformat-nonliteral -Wformat-security
26# -Wformat=2 -Winit-self -Wmissing-declarations
27# -Wmissing-format-attribute -Wmissing-include-dirs
28# -Wmissing-noreturn -Wmissing-prototypes -Wnested-externs
29# -Wpointer-arith -Wshadow -Wstrict-prototypes
30# -Wswitch-default -Wunsafe-loop-optimizations
31# -Wwrite-strings -Werror -fPIC
32# -Wno-missing-field-initializers
33)
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
41set (SRC
42 main.c
43 benchmark_aux.c
44)
45
46################################################################################
47# Built binary
48################################################################################
49add_executable (${PROJECT_NAME} ${SRC})
50
51target_link_libraries (${PROJECT_NAME}
52 PRIVATE ${CMAKE_THREAD_LIBS_INIT}
53 PRIVATE teec
54 PRIVATE yaml
55 PRIVATE m
56)
57
58################################################################################
59# Install targets
60################################################################################
61install (TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR})