CMake: overhaul and improve scripts
- Bump minimum required version and make use of more modern language features - Rely more on target_...() commands to establish dependency relationships between targets rather than directory property commands - Improve libtorrent package discovery - Enable and handle application features more explicitly - Improve user-facing output - Fix various compilation issues on Windows (MSVC and MinGW) and macOS - Improve handling of translations - Add explanatory comments where relevant - Make CMake scripts fully independent of qmake files/details - Remove old functions/macros
This commit is contained in:
76
dist/unix/CMakeLists.txt
vendored
76
dist/unix/CMakeLists.txt
vendored
@ -1,48 +1,56 @@
|
||||
if (NOT Qt5Widgets_FOUND)
|
||||
feature_option(SYSTEMD "Install systemd service file (headless only)" OFF)
|
||||
if (SYSTEMD)
|
||||
if (NOT Systemd_SERVICES_INSTALL_DIR)
|
||||
find_package(Systemd)
|
||||
if (NOT Systemd_FOUND)
|
||||
message(FATAL_ERROR "Could not locate systemd services install dir."
|
||||
" Either pass -DSystemd_SERVICES_INSTALL_DIR=/path/to/systemd/services option or install systemd pkg-config")
|
||||
endif(NOT Systemd_FOUND)
|
||||
endif(NOT Systemd_SERVICES_INSTALL_DIR)
|
||||
set(EXPAND_BINDIR ${CMAKE_INSTALL_FULL_BINDIR})
|
||||
configure_file(systemd/qbittorrent-nox@.service.in ${CMAKE_CURRENT_BINARY_DIR}/qbittorrent-nox@.service @ONLY)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/qbittorrent-nox@.service
|
||||
DESTINATION ${Systemd_SERVICES_INSTALL_DIR}
|
||||
COMPONENT data)
|
||||
endif(SYSTEMD)
|
||||
if (SYSTEMD)
|
||||
if (NOT SYSTEMD_SERVICES_INSTALL_DIR)
|
||||
find_package(Systemd)
|
||||
if (NOT SYSTEMD_FOUND)
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"Could not locate systemd services install dir."
|
||||
" Either pass the -DSYSTEMD_SERVICES_INSTALL_DIR=/path/to/systemd/services option"
|
||||
" or install systemd pkg-config"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
set(EXPAND_BINDIR ${CMAKE_INSTALL_FULL_BINDIR})
|
||||
configure_file(systemd/qbittorrent-nox@.service.in ${CMAKE_CURRENT_BINARY_DIR}/qbittorrent-nox@.service @ONLY)
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/qbittorrent-nox@.service"
|
||||
DESTINATION ${SYSTEMD_SERVICES_INSTALL_DIR}
|
||||
COMPONENT data
|
||||
)
|
||||
endif()
|
||||
|
||||
if (Qt5Widgets_FOUND)
|
||||
list(APPEND MAN_FILES ${qBittorrent_SOURCE_DIR}/doc/qbittorrent.1)
|
||||
else (Qt5Widgets_FOUND)
|
||||
list(APPEND MAN_FILES ${qBittorrent_SOURCE_DIR}/doc/qbittorrent-nox.1)
|
||||
endif (Qt5Widgets_FOUND)
|
||||
if (GUI)
|
||||
list(APPEND MAN_FILES ${PROJECT_SOURCE_DIR}/doc/qbittorrent.1)
|
||||
else()
|
||||
list(APPEND MAN_FILES ${PROJECT_SOURCE_DIR}/doc/qbittorrent-nox.1)
|
||||
endif()
|
||||
|
||||
install(FILES ${MAN_FILES}
|
||||
DESTINATION ${CMAKE_INSTALL_MANDIR}/man1
|
||||
COMPONENT doc)
|
||||
DESTINATION ${CMAKE_INSTALL_MANDIR}/man1
|
||||
COMPONENT doc
|
||||
)
|
||||
|
||||
if (Qt5Widgets_FOUND)
|
||||
if (GUI)
|
||||
install(DIRECTORY menuicons/
|
||||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor
|
||||
FILES_MATCHING PATTERN "*.png")
|
||||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor
|
||||
COMPONENT data
|
||||
FILES_MATCHING PATTERN "*.png"
|
||||
)
|
||||
|
||||
install(FILES org.qbittorrent.qBittorrent.desktop
|
||||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications/
|
||||
COMPONENT data)
|
||||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications/
|
||||
COMPONENT data
|
||||
)
|
||||
|
||||
install(FILES org.qbittorrent.qBittorrent.appdata.xml
|
||||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/metainfo/
|
||||
COMPONENT data)
|
||||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/metainfo/
|
||||
COMPONENT data
|
||||
)
|
||||
|
||||
install(FILES
|
||||
${qBittorrent_SOURCE_DIR}/src/icons/qbittorrent-tray.svg
|
||||
${qBittorrent_SOURCE_DIR}/src/icons/qbittorrent-tray-dark.svg
|
||||
${qBittorrent_SOURCE_DIR}/src/icons/qbittorrent-tray-light.svg
|
||||
${PROJECT_SOURCE_DIR}/src/icons/qbittorrent-tray.svg
|
||||
${PROJECT_SOURCE_DIR}/src/icons/qbittorrent-tray-dark.svg
|
||||
${PROJECT_SOURCE_DIR}/src/icons/qbittorrent-tray-light.svg
|
||||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/status
|
||||
COMPONENT data)
|
||||
COMPONENT data
|
||||
)
|
||||
endif()
|
||||
|
Reference in New Issue
Block a user