-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
92 lines (70 loc) · 2.38 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
81
82
83
84
85
86
87
88
89
90
91
92
cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR)
# for cleaning build types
include(cmake/precheck.cmake)
project(lyricsx)
set(VERSION_MAJOR 1)
set(VERSION_MINOR 1)
set(VERSION_PATCH 1)
set(version "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
set(LRCX_RUNTIME_DIR "${CMAKE_INSTALL_PREFIX}/lib/lyricsx")
include(CMakeParseArguments)
include(CheckIncludeFiles)
include(cmake/macro.cmake)
include(cmake/options.cmake)
include_platform(flags)
# uninstall target
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
find_package(Qt5Widgets REQUIRED)
find_package(Qt5Core REQUIRED)
find_package(Qt5Multimedia REQUIRED)
find_package(Qt5DBus QUIET)
if (DEFINED Qt5DBus_FOUND)
set(LRCX_HAVE_DBUS TRUE)
endif()
if (LRCX_ENABLE_TESTS)
find_package(Qt5Test REQUIRED)
endif()
set(CMAKE_INCLUDE_CURRENT_DIR ON)
SET(CMAKE_INSTALL_RPATH "${LRCX_RUNTIME_DIR}")
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
# for generating qm files only
set(LRCX_TRANSLATIONS_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/bin/translations")
set(LRCX_DATA_DIR "${CMAKE_INSTALL_PREFIX}/share/lyricsx")
set(LRCX_TRANSLAIONS_DIR "${LRCX_DATA_DIR}/translations")
configure_file(${PROJECT_SOURCE_DIR}/config.h.in ${PROJECT_BINARY_DIR}/config.h)
# copy the Qt libs to bin dir
if (LRCX_ENABLE_TESTS)
set(QT5_TESTLIB Qt5::Test)
endif()
if (LRCX_HAVE_DBUS)
set(QT5_DBUSLIB Qt5::DBus)
endif()
copy_qt_libs(${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
Qt5::Core
Qt5::Widgets
Qt5::Multimedia
Qt5::Gui
Qt5::Network # Qt5::Multimedia
${QT5_DBUSLIB}
${QT5_TESTLIB}
)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
include_directories(${CMAKE_CURRENT_BINARY_DIR}/include)
add_subdirectory(src)
add_subdirectory(data)
if (LRCX_ENABLE_TESTS)
add_subdirectory(tests)
endif()