Jens Wiklander | 7437cb2 | 2018-02-08 17:54:30 +0100 | [diff] [blame] | 1 | cmake_minimum_required (VERSION 3.2) |
| 2 | project (benchmark C) |
| 3 | |
| 4 | # Default cross compile settings |
| 5 | set (CMAKE_TOOLCHAIN_FILE CMakeToolchain.txt) |
| 6 | |
| 7 | ################################################################################ |
| 8 | # Packages |
| 9 | ################################################################################ |
| 10 | find_package(Threads REQUIRED) |
| 11 | if(NOT THREADS_FOUND) |
| 12 | message(FATAL_ERROR "Threads not found") |
| 13 | endif() |
| 14 | |
| 15 | include(GNUInstallDirs) |
| 16 | |
| 17 | ################################################################################ |
| 18 | # Compiler flags: |
| 19 | # We want to use the same flags in the entire optee_client git |
| 20 | ################################################################################ |
| 21 | add_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 | |
| 35 | find_program(CCACHE_FOUND ccache) |
| 36 | if(CCACHE_FOUND) |
| 37 | set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache) |
| 38 | set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache) |
| 39 | endif(CCACHE_FOUND) |
| 40 | |
| 41 | set (SRC |
| 42 | main.c |
| 43 | benchmark_aux.c |
| 44 | ) |
| 45 | |
| 46 | ################################################################################ |
| 47 | # Built binary |
| 48 | ################################################################################ |
| 49 | add_executable (${PROJECT_NAME} ${SRC}) |
| 50 | |
| 51 | target_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 | ################################################################################ |
| 61 | install (TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR}) |