CMakeLists.txt 2.79 KB
Newer Older
1
cmake_minimum_required(VERSION 2.8.11)
2 3
set(CMAKE_CXX_STANDARD 14)
set(QT_MIN_VERSION "5.7.0")
4
set(BOOST_MIN_VERSION "1.34.1")
5 6 7

project(kaidan)

8 9 10
# CMake options
option(I18N "Enable i18n support" FALSE)

11 12 13 14
# application name
set(APPLICATION_ID "harbour.kaidan")
set(APPLICATION_NAME "kaidan")
set(APPLICATION_DISPLAY_NAME "Kaidan")
15
set(APPLICATION_DESCRIPTION "Cross platform XMPP client")
16

17 18 19
set(ORGANIZAITON_NAME "KaidanIM")
set(ORGANIZATION_DOMAIN "kaidanim.github.io")

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
# Version
set(VERSION_MAJOR 0)
set(VERSION_MINOR 0)
set(VERSION_PATCH 1)
set(VERSION_EXTRA "" CACHE STRING "Stuff to append to version string")

set(VERSION_STRING "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
if(VERSION_EXTRA)
	set(VERSION_STRING ${VERSION_STRING}-${VERSION_EXTRA})
endif()


# Find includes in corresponding build directories
set(CMAKE_INCLUDE_CURRENT_DIR ON)

# Instruct CMake to run moc, uic and rcc automatically when needed.
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)


# Set output path for executables
set(EXECUTABLE_OUTPUT_PATH "bin")


45 46 47 48
#
# Dependecies
#

49 50 51 52
# CMake module path
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")

# Find packages
53
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED NO_MODULE COMPONENTS Core Qml Quick Sql)
54 55
find_package(KF5Kirigami REQUIRED)
find_package(Swiften REQUIRED)
56
find_package(Boost ${BOOST_MIN_VERSION} REQUIRED COMPONENTS signals)
57
include(GNUInstallDirs)
58

59 60 61 62
#
# Translation
#

63 64 65
if(I18N)
	include("${CMAKE_SOURCE_DIR}/i18n/CMakeLists.txt")
endif()
66 67 68 69

#
# Sources / Resources
#
70 71 72

add_executable(${PROJECT_NAME}
	kaidan.qrc
73
	${I18N_QRC_CPP} # set in i18n/CMakeLists.txt, if enabled
74 75 76
	src/main.cpp
	src/Kaidan.cpp
	src/RosterController.cpp
77 78 79
	src/RosterModel.cpp
	src/MessageController.cpp
	src/MessageModel.cpp
80 81
)

82 83 84 85
#
# Linker Flags
#

86 87
target_link_libraries(${PROJECT_NAME}
	Qt5::Core
88
	Qt5::Sql
89 90
	Qt5::Qml
	Qt5::Quick
91
	Boost::signals
92 93
	${SWIFTEN_LIBRARY}
)
94

95 96 97 98
#
# Global C++ variables
#

99 100 101 102
target_compile_definitions(${PROJECT_NAME} PRIVATE
	APPLICATION_ID="${APPLICATION_ID}"
	APPLICATION_NAME="${APPLICATION_NAME}"
	APPLICATION_DISPLAY_NAME="${APPLICATION_DISPLAY_NAME}"
103
	APPLICATION_DESCRIPTION="${APPLICATION_DESCRIPTION}"
104 105
	ORGANIZAITON_NAME="${ORGANIZAITON_NAME}"
	ORGANIZATION_DOMAIN="${ORGANIZATION_DOMAIN}"
106 107

	VERSION_STRING="${VERSION_STRING}"
108 109

	BOOST_SIGNALS_NO_DEPRECATION_WARNING=True
110
)
111 112 113 114 115 116


#
# Install Kaidan binary
#

117 118 119 120 121 122 123 124 125 126 127 128 129 130 131
if(UNIX AND NOT APPLE)
	# install kaidan binary
	install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${EXECUTABLE_OUTPUT_PATH}/${PROJECT_NAME}
		DESTINATION ${CMAKE_INSTALL_FULL_BINDIR}
	)

	# install icon (scalable + 128x)
	install(FILES "misc/kaidan.svg"
		DESTINATION "${CMAKE_INSTALL_FULL_DATADIR}/icons/hicolor/scalable/apps"
	)
	install(FILES "misc/kaidan-128x128.png"
		DESTINATION "${CMAKE_INSTALL_FULL_DATADIR}/icons/hicolor/128x128/apps"
		RENAME "kaidan.png"
	)
endif()