-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
80 lines (62 loc) · 1.75 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
cmake_minimum_required(VERSION 2.8.11)
#
# Project settings
#
project(qtunits)
set(TESTS_BINARY_NAME "qtunits-tests")
#
# Build flags & compiler settings
#
# Define the Build flags
option(Shared "Build QtUnits as a shared libarary." ON)
option(DebugBuild "Build debug binaries." OFF)
option(CCache "Build using ccache." OFF)
option(Tests "Build the tests executable" OFF)
# Configure library options
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR})
if(Shared)
set(QTUNITS_SHARED ON)
else()
add_definitions(-DQTUNITS_STATIC)
endif()
# Set the CMAKE_BUILD_TYPE (Only DEBUG and RELEASE are supported)
if(DebugBuild)
set(CMAKE_BUILD_TYPE DEBUG)
message(STATUS "CMAKE_BUILD_TYPE = DEBUG")
else()
set(CMAKE_BUILD_TYPE RELEASE)
message(STATUS "CMAKE_BUILD_TYPE = RELEASE")
endif()
# Optionally set the compiler
if(CCache)
SET_PROPERTY(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
endif()
# Set the compilation flags
set(CMAKE_VERBOSE_MAKEFILE OFF)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -Wall -Wextra -pedantic -Wno-multichar -Wno-reorder")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -g")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -O3 -fomit-frame-pointer -finline-functions")
#
# Find and include external dependencies
#
# Qt
find_package(Qt5Core REQUIRED)
find_package(Qt5Widgets REQUIRED)
set(CMAKE_AUTOMOC ON)
# Boost
find_package(Boost REQUIRED)
if(Boost_FOUND)
message(STATUS "Including Boost from: ${Boost_INCLUDE_DIRS}")
include_directories(${Boost_INCLUDE_DIRS})
endif()
#
# Include subdirectories
#
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR})
INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/src")
# Include the subdirectories
add_subdirectory(src)
if(Tests)
find_package(Qt5Test REQUIRED)
add_subdirectory(tests)
endif()