feat: add an icon...
This commit is contained in:
@ -2,6 +2,8 @@ cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
project(pineapple-music LANGUAGES CXX)
|
||||
|
||||
include (GNUInstallDirs)
|
||||
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
@ -13,7 +15,9 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
find_package(Qt5 COMPONENTS Widgets Multimedia REQUIRED)
|
||||
|
||||
add_executable(pineapple-music
|
||||
set (EXE_NAME pmusic)
|
||||
|
||||
add_executable(${EXE_NAME}
|
||||
main.cpp
|
||||
mainwindow.cpp
|
||||
mainwindow.h
|
||||
@ -25,4 +29,52 @@ add_executable(pineapple-music
|
||||
resources.qrc
|
||||
)
|
||||
|
||||
target_link_libraries(pineapple-music PRIVATE Qt5::Widgets Qt5::Multimedia)
|
||||
target_link_libraries(${EXE_NAME} PRIVATE Qt5::Widgets Qt5::Multimedia)
|
||||
|
||||
# Helper macros for install settings
|
||||
macro (pmusic_convert_to_relative_path _var)
|
||||
# Make sure _var is a relative path
|
||||
if (IS_ABSOLUTE "${${_var}}")
|
||||
file (RELATIVE_PATH ${_var} "${CMAKE_INSTALL_PREFIX}" "${${_var}}")
|
||||
endif ()
|
||||
endmacro ()
|
||||
|
||||
# Install settings
|
||||
if (WIN32)
|
||||
# FIXME: try to avoid install to a "bin" subfolder under windows...
|
||||
# when fixed, don't forget to update the CI config file...
|
||||
set (BIN_INSTALL_DIR "") # seems useless, don't know why...
|
||||
elseif (UNIX)
|
||||
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
||||
set(CMAKE_INSTALL_PREFIX /usr)
|
||||
endif ()
|
||||
|
||||
set (BIN_INSTALL_DIR "${CMAKE_INSTALL_BINDIR}") # relative, usually "bin"
|
||||
pmusic_convert_to_relative_path(BIN_INSTALL_DIR)
|
||||
set (LIB_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}") # "lib" or "lib64"
|
||||
pmusic_convert_to_relative_path(LIB_INSTALL_DIR)
|
||||
|
||||
# install icon
|
||||
install (
|
||||
FILES icons/app-icon.svg
|
||||
DESTINATION "${CMAKE_INSTALL_DATADIR}/icons/hicolor/48x48/apps"
|
||||
RENAME pineapple-music.svg
|
||||
)
|
||||
|
||||
# install shortcut
|
||||
install (
|
||||
FILES pineapple-music.desktop
|
||||
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/applications"
|
||||
)
|
||||
endif()
|
||||
|
||||
set (INSTALL_TARGETS_DEFAULT_ARGS
|
||||
RUNTIME DESTINATION ${BIN_INSTALL_DIR}
|
||||
LIBRARY DESTINATION ${LIB_INSTALL_DIR}
|
||||
ARCHIVE DESTINATION ${LIB_INSTALL_DIR} COMPONENT Devel
|
||||
)
|
||||
|
||||
install (
|
||||
TARGETS ${EXE_NAME}
|
||||
${INSTALL_TARGETS_DEFAULT_ARGS}
|
||||
)
|
||||
|
Reference in New Issue
Block a user