-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathCMakeLists.txt
112 lines (92 loc) · 2.83 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
cmake_minimum_required(VERSION 3.9)
project(youtubedl-gui LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
INCLUDE(GNUInstallDirs)
INCLUDE(CheckIPOSupported)
#Set default prefix to /usr
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "/usr")
endif()
# check if compiler supports link time optmizations and enable it
if(LINUX)
check_ipo_supported(RESULT result)
if (CMAKE_COMPILER_IS_GNUCXX) # clang lto with qt is broken.
if(result)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
endif()
endif()
endif()
# uninstall target
if(NOT TARGET uninstall)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/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)
endif()
find_package(QT NAMES Qt6 Qt5 COMPONENTS Widgets REQUIRED)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Widgets REQUIRED)
set(SRC
#headers
src/canceldownload.h
src/downloadprogress.h
src/downloadstatus.h
src/mainactions.h
src/maincommand.h
src/ytdl.h
src/readconfig.h
#cpp
src/canceldownload.cpp
src/downloadprogress.cpp
src/downloadstatus.cpp
src/main.cpp
src/mainactions.cpp
src/maincommand.cpp
src/ytdl.cpp
src/readconfig.cpp
#ui
src/downloadstatus.ui
src/ytdl.ui)
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
qt_add_executable(youtubedl-gui
${SRC}
)
else()
if(ANDROID)
add_library(youtubedl-gui SHARED
${SRC}
)
else()
add_executable(youtubedl-gui
${SRC}
)
endif()
endif()
target_link_libraries(youtubedl-gui PRIVATE Qt${QT_VERSION_MAJOR}::Widgets)
install(TARGETS youtubedl-gui RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
install(FILES icons/16x16.png
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/16x16/apps
RENAME youtubedl-gui.png)
install(FILES icons/32x32.png
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/32x32/apps
RENAME youtubedl-gui.png)
install(FILES icons/64x64.png
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/64x64/apps
RENAME youtubedl-gui.png)
install(FILES icons/128x128.png
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/128x128/apps
RENAME youtubedl-gui.png)
install(FILES icons/256x256.png
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/256x256/apps
RENAME youtubedl-gui.png)
install(FILES icons/512x512.png
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/512x512/apps
RENAME youtubedl-gui.png)
install(FILES resources/youtubedl-gui.desktop
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications)