-
Notifications
You must be signed in to change notification settings - Fork 18
/
CMakeLists.txt
79 lines (65 loc) · 2.77 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
cmake_minimum_required(VERSION 2.8.8)
project(kochmorse)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake)
include(InstallHeadersWithDirectory)
option(WITH_QSOCHAT "Enabled build of QSO chat commandline test tool." OFF)
option(WITH_TEXTGEN "Enabled build of text generation test tool." OFF)
option(CHECK_FOR_UPDATES "Enables online check for updates." OFF)
find_package(Qt5Core REQUIRED)
find_package(Qt5Widgets REQUIRED)
find_package(Qt5Multimedia REQUIRED)
find_package(Qt5LinguistTools REQUIRED)
ADD_DEFINITIONS(${Qt5Widgets_DEFINITIONS})
set(VERSION_MAJOR 3)
set(VERSION_MINOR 5)
set(VERSION_PATCH 1)
configure_file(${PROJECT_SOURCE_DIR}/src/config.h.in ${PROJECT_BINARY_DIR}/src/config.h)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
INCLUDE_DIRECTORIES(${Qt5Core_INCLUDE_DIRS})
INCLUDE_DIRECTORIES(${Qt5Declarative_INCLUDE_DIRS})
INCLUDE_DIRECTORIES(${Qt5Widgets_INCLUDE_DIRS})
INCLUDE_DIRECTORIES(${Qt5Multimedia_INCLUDE_DIRS})
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/src)
INCLUDE_DIRECTORIES(${PROJECT_BINARY_DIR}/src)
LINK_DIRECTORIES(${PROJECT_BINARY_DIR}/src)
set(LIBS ${Qt5Core_LIBRARIES} ${Qt5Core_QTMAIN_LIBRARIES} ${Qt5Widgets_LIBRARIES}
${Qt5Multimedia_LIBRARIES} ${KOCHMORSE_LIBS})
# Set compiler flags
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS} -Wall -std=c++11")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -ggdb")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -ggdb")
# Get default install directories under Linux
IF(UNIX AND NOT APPLE)
INCLUDE(GNUInstallDirs)
ELSE(UNIX AND NOT APPLE)
SET(CMAKE_INSTALL_LIBDIR "lib")
SET(CMAKE_INSTALL_FULL_LIBDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
SET(CMAKE_INSTALL_INCLUDEDIR "include")
SET(CMAKE_INSTALL_FULL_INCLUDEDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}")
# Set RPATH under MacOS
SET(CMAKE_SKIP_BUILD_RPATH FALSE)
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
ENDIF(UNIX AND NOT APPLE)
# Sources...
add_subdirectory(src)
# Source distribution packages:
set(CPACK_PACKAGE_VERSION_MAJOR "${VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${VERSION_MINOR}")
set(CPACK_PACKAGE_VERSION_PATCH "${VERSION_PATCH}")
set(CPACK_SOURCE_GENERATOR "TGZ")
set(CPACK_SOURCE_PACKAGE_FILE_NAME
"${CMAKE_PROJECT_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
set(CPACK_SOURCE_IGNORE_FILES
"/build/;/doc/;/dist/;/.git/;~$;.user$;${CPACK_SOURCE_IGNORE_FILES}")
#
# Install logo and .desktop file under Linux:
#
IF(UNIX AND NOT APPLE)
INSTALL(FILES shared/kochmorse.svg
DESTINATION share/icons)
INSTALL(FILES shared/kochmorse.desktop
DESTINATION share/applications)
ENDIF(UNIX AND NOT APPLE)
include(CPack)