This repository has been archived by the owner on Jan 31, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
137 lines (104 loc) · 4.11 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# -*- CMake -*-
####################################################################################################
#
# Customizable settings
#
# -D <var>:<type>=<value>: Create a cmake cache entry.
# Ipl path
# -D IPL_PATH:PATH=
# Install path prefix, prepended onto install directories.
# -D CMAKE_INSTALL_PREFIX:PATH=/usr/local/stow/bar
# Choose the type of build, options are: None(CMAKE_CXX_FLAGS or
# CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.
# -D CMAKE_BUILD_TYPE:STRING=Debug
# If this value is on, makefiles will be generated without the
# .SILENT directive, and all commands will be echoed to the console
# during the make. This is useful for debugging only.
# -D CMAKE_VERBOSE_MAKEFILE:BOOL=ON
####################################################################################################
project(AlpineToolkit)
set(ALPINE_TOOLKIT_VERSION_MAJOR 1)
set(ALPINE_TOOLKIT_VERSION_MINOR 0)
set(ALPINE_TOOLKIT_VERSION_PATCH 0)
set(ALPINE_TOOLKIT_VERSION ${ALPINE_TOOLKIT_VERSION_MAJOR}.${ALPINE_TOOLKIT_VERSION_MINOR}.${ALPINE_TOOLKIT_VERSION_PATCH})
####################################################################################################
# check cmake version
cmake_minimum_required(VERSION 3.0.0 FATAL_ERROR)
if(POLICY CMP0990)
cmake_policy(SET CMP0990 NEW)
endif()
# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
####################################################################################################
#
# Test
#
enable_testing()
####################################################################################################
#
# Compiler Options
#
# SET(CMAKE_BUILD_TYPE RELEASE)
SET(CMAKE_BUILD_TYPE DEBUG)
SET(CMAKE_VERBOSE_MAKEFILE ON)
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
CHECK_CXX_COMPILER_FLAG("-std=c++14" COMPILER_SUPPORTS_CXX14)
if(COMPILER_SUPPORTS_CXX14)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
elseif(COMPILER_SUPPORTS_CXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
else()
message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support.")
endif()
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
set(CMAKE_CXX_FLAGS_COMMON "-Wall -DSystemLinux -fdiagnostics-color=auto")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_COMMON} -g -O0 -DDEBUG")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_COMMON} $ENV{GCC_OPTIMISATION}")
endif(CMAKE_SYSTEM_NAME MATCHES "Linux")
if(CMAKE_SYSTEM_NAME MATCHES "Windows")
endif(CMAKE_SYSTEM_NAME MATCHES "Windows")
####################################################################################################
#
# Find Qt
#
# Find includes in corresponding build directories
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# Instruct CMake to run moc automatically when needed.
set(CMAKE_AUTOMOC ON)
# Instruct CMake to run rcc automatically when needed.
set(CMAKE_AUTORCC ON)
find_package(Qt5Core REQUIRED)
find_package(Qt5Gui REQUIRED)
find_package(Qt5Network REQUIRED)
find_package(Qt5Positioning REQUIRED)
find_package(Qt5Qml REQUIRED)
find_package(Qt5Quick REQUIRED) # QtQuickWidgets
find_package(Qt5Widgets REQUIRED)
find_package(Qt5Sensors REQUIRED)
find_package(Qt5Sql REQUIRED)
find_package(Qt5Test REQUIRED)
# only available for Android build
# find_package(Qt5AndroidExtras REQUIRED)
# find_package(Qt5Xml REQUIRED)
# find_package(Qt5WebView REQUIRED)
# charts
# quickcontrols
# svg
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DQT_QML_DEBUG") # Fixme: right way to do?
# INCLUDE_DIRECTORIES(${Qt5Core_INCLUDES})
# ADD_DEFINITIONS(${Qt5Core_DEFINITIONS})
# SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Core_EXECUTABLE_COMPILE_FLAGS}")
####################################################################################################
#
# Sub directories
#
INCLUDE_DIRECTORIES(src)
add_subdirectory(src)
add_subdirectory(test)
# add_subdirectory(imports)
####################################################################################################
#
# End
#
####################################################################################################