-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: Compatibility with Qt5 + CPack configuration in CMakeLists
This patch adds CPack configuration to CMakeLists so CONTROL file for .deb packages can be deleted, and we can setup everything through cmake.
- Loading branch information
Showing
1 changed file
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -108,3 +108,61 @@ install(TARGETS D1GraphicsTool | |
if(QT_VERSION_MAJOR EQUAL 6) | ||
qt_finalize_executable(D1GraphicsTool) | ||
endif() | ||
|
||
if(CMAKE_SYSTEM_NAME STREQUAL "Linux") | ||
set(CPACK ON) | ||
endif() | ||
|
||
# RELEASE_OPTION(CPACK "Configure CPack") | ||
if(CPACK) | ||
string(TOLOWER ${PROJECT_NAME} project_name) | ||
set(CPACK_PACKAGE_NAME ${project_name}) | ||
|
||
# Common *nix files | ||
set(CPACK_STRIP_FILES TRUE) | ||
install(TARGETS ${BIN_TARGET} DESTINATION bin) | ||
|
||
# set(desktop_file "${PROJEC_SOURCE_DIR}/debian/usr/share/applications/${PROJECT_NAME}") | ||
set(desktop_file "${CMAKE_BINARY_DIR}/${PROJECT_NAME}") | ||
|
||
# find_program(DFI desktop-file-install) | ||
# if(DFI) | ||
# execute_process(COMMAND ${DFI} --dir=${CMAKE_BINARY_DIR} ${desktop_file}) | ||
# set(desktop_file "${CMAKE_BINARY_DIR}/${PROJECT_NAME}") | ||
# endif() | ||
|
||
|
||
install(FILES "${desktop_file}" | ||
DESTINATION "/usr/bin/" | ||
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE | ||
) | ||
|
||
install(FILES "${PROJECT_SOURCE_DIR}/debian/usr/share/applications/${PROJECT_NAME}.desktop" | ||
DESTINATION "/usr/share/applications" | ||
) | ||
|
||
install(FILES "${PROJECT_SOURCE_DIR}/resources/icon.svg" | ||
DESTINATION "/opt/d1-graphics-tool/" | ||
RENAME "icon.svg" | ||
) | ||
|
||
# -G DEB | ||
set(CPACK_PACKAGE_CONTACT "[email protected]") | ||
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6) | ||
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libqt6widgets6 (>= 6.2.4), qt6-qpa-plugins (>= 6.2.4)") | ||
else() | ||
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libqt5widgets5 (>= 5.15.0)") | ||
endif() | ||
set(CPACK_DEBIAN_FILE_NAME DEB-DEFAULT) | ||
|
||
find_program(DPKG dpkg) | ||
if(DPKG) | ||
list(APPEND CPACK_GENERATOR "DEB") | ||
endif() | ||
|
||
set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR}) | ||
set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR}) | ||
set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH}) | ||
include(CPack) | ||
|
||
endif() |