forked from ksnip/ksnip
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
75 lines (55 loc) · 2.02 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
cmake_minimum_required(VERSION 3.5)
project(ksnip LANGUAGES CXX VERSION 1.8.0)
if (DEFINED VERSION_SUFIX AND NOT "${VERSION_SUFIX}" STREQUAL "")
set(KSNIP_VERSION_SUFIX "-${VERSION_SUFIX}")
endif()
set(KSNIP_VERSION "${PROJECT_VERSION}${KSNIP_VERSION_SUFIX}")
include(GNUInstallDirs)
if (WIN32)
set(KSNIP_LANG_INSTALL_DIR "translations")
set(KIMAGEANNOTATOR_LANG_INSTALL_DIR "translations")
elseif (APPLE)
set(KSNIP_LANG_INSTALL_DIR "../Resources")
set(KIMAGEANNOTATOR_LANG_INSTALL_DIR "../Resources")
elseif (UNIX)
set(KSNIP_LANG_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/ksnip/translations")
set(KIMAGEANNOTATOR_LANG_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/kImageAnnotator/translations")
endif ()
configure_file(src/BuildConfig.h.in ${CMAKE_CURRENT_BINARY_DIR}/src/BuildConfig.h)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
option(BUILD_TESTS "Build Unit Tests" OFF)
if (UNIX AND NOT APPLE)
# Without ECM we're unable to load XCB
find_package(ECM REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
find_package(X11 REQUIRED)
find_package(XCB COMPONENTS XFIXES)
endif ()
set(QT_COMPONENTS Core Widgets Network Xml PrintSupport DBus Svg)
set(QT_MIN_VERSION 5.9.4)
if (X11_FOUND)
list(APPEND QT_COMPONENTS X11Extras)
elseif (WIN32)
list(APPEND QT_COMPONENTS WinExtras)
endif()
if (BUILD_TESTS)
list(APPEND QT_COMPONENTS Test)
endif()
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED ${QT_COMPONENTS})
set(KIMAGEANNOTATOR_MIN_VERSION "0.4.0")
find_package(kImageAnnotator ${KIMAGEANNOTATOR_MIN_VERSION} REQUIRED)
set(BASEPATH "${CMAKE_SOURCE_DIR}")
include_directories("${BASEPATH}")
add_subdirectory(src)
add_subdirectory(translations)
add_subdirectory(desktop)
if (BUILD_TESTS)
configure_file(src/BuildConfig.h.in ${CMAKE_CURRENT_BINARY_DIR}/tests/BuildConfig.h)
enable_testing()
add_subdirectory(tests)
endif (BUILD_TESTS)