forked from gitahead/gitahead
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
64 lines (54 loc) · 1.41 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
cmake_minimum_required(VERSION 3.3.1)
project(GitAhead)
# Set name and version.
set(GITAHEAD_NAME "GitAhead")
set(GITAHEAD_VERSION_MAJOR 2)
set(GITAHEAD_VERSION_MINOR 5)
set(GITAHEAD_VERSION_PATCH 3)
set(GITAHEAD_VERSION
"${GITAHEAD_VERSION_MAJOR}.${GITAHEAD_VERSION_MINOR}.${GITAHEAD_VERSION_PATCH}"
)
# Generate build date.
string(TIMESTAMP GITAHEAD_BUILD_DATE)
# Lookup git revision.
find_package(Git)
if(GIT_FOUND)
execute_process(
COMMAND ${GIT_EXECUTABLE} show -s --format=%h HEAD
OUTPUT_VARIABLE GITAHEAD_BUILD_REVISION
OUTPUT_STRIP_TRAILING_WHITESPACE
)
else()
set(GITAHEAD_BUILD_REVISION "unknown")
endif()
# Explicitly disable shared libraries.
set(BUILD_SHARED_LIBS OFF)
# Require C++11.
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
# Disable exceptions and RTTI.
if(WIN32)
string(REPLACE "/EHsc" "/EHs-c-" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
string(REPLACE "/GR" "/GR-" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions -fno-rtti")
endif()
if(UNIX AND NOT APPLE)
set(CMAKE_EXE_LINKER_FLAGS -ldl)
endif()
# Find Qt modules.
set(QT_MODULES
Concurrent
Core
Gui
Network
PrintSupport
Widgets
Test
)
set(Qt5_DIR ${CMAKE_BINARY_DIR}/../qt/qtbase/lib/cmake/Qt5 CACHE PATH "")
find_package(Qt5 5.9 COMPONENTS ${QT_MODULES} REQUIRED)
add_subdirectory(dep)
add_subdirectory(src)
add_subdirectory(test)
add_subdirectory(pack)