-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
48 lines (34 loc) · 1.63 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
36
37
38
39
40
41
42
43
44
45
46
47
cmake_minimum_required(VERSION 3.1)
project(tekon-utils C)
# Определить хостовую и целевую системы
set (TEKON_HOST_OS ${CMAKE_SYSTEM_NAME} CACHE STRING "Host OS name")
if(NOT TEKON_TARGET_OS)
message("Target OS not specified. Use default")
set(TEKON_TARGET_OS ${TEKON_HOST_OS} CACHE STRING "Target OS name")
endif()
message("Host OS:" ${TEKON_HOST_OS})
message("Target OS:" ${TEKON_TARGET_OS})
# Обязательные флаги для всех типов сборок
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_GNU_SOURCE")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_GNU_SOURCE")
set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} -D_GNU_SOURCE")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -D_GNU_SOURCE")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -D_GNU_SOURCE")
# Настройка директорий для включения
include_directories (${CMAKE_CURRENT_SOURCE_DIR})
# Настройка тестов
option (TEKON_TESTS_ON "Build tests" ON)
if (${TEKON_TESTS_ON})
enable_testing()
option (TEKON_TESTS_COVERAGE "Build test with coverage support" OFF)
if (${TEKON_TESTS_COVERAGE})
set(CMAKE_BUILD_TYPE "Debug")
set(CMAKE_C_FLAGS_DEBUG "-g -O0 -Wall -fprofile-arcs -ftest-coverage -D_GNU_SOURCE")
message(STATUS "Coverage is ON. Using predefined compiler flags")
message(STATUS "TYPE: ${CMAKE_BUILD_TYPE}")
message(STATUS "CFLAGS: ${CMAKE_C_FLAGS_DEBUG}")
endif()
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/test)
endif()
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tekon)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/utils)