build: Simple CPack Package

This commit is contained in:
sithlord48 2024-07-27 11:10:43 -04:00 committed by Rick Blommers
parent 8cb4748a36
commit 8d290c740d

View File

@ -37,7 +37,7 @@ endif()
set(QTAWESOME_VERSION "${QTAWESOME_VERSION_MAJOR}.${QTAWESOME_VERSION_MINOR}.${QTAWESOME_VERSION_PATCH}.${QTAWESOME_VERSION_TWEAK}")
message(STATUS "Building QTAWESOME: ${QTAWESOME_VERSION}")
project(QtAwesome VERSION ${QTAWESOME_VERSION})
project(QtAwesome VERSION ${QTAWESOME_VERSION} DESCRIPTION "Add Font Awesome icons to your Qt application")
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Widgets)
@ -93,3 +93,51 @@ install(EXPORT QtAwesomeConfig
)
export(EXPORT QtAwesomeConfig NAMESPACE QtAwesome::)
## PACKAGES
#Generic Info
set(CPACK_PACKAGE_CONTACT "rick@blommersit.nl")
set(CPACK_STRIP_FILES TRUE)
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE.md")
set(CPACK_PACKAGE_NAME "QtAwesome")
set(CPACK_PACKAGE_VENDOR "gamecreature")
set(CPACK_PACKAGE_HOMEPAGE_URL "https://github.com/gamecreature/QtAwesome")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY ${CMAKE_PROJECT_DESCRIPTION})
## SET OS NAME
if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
set(OS_STRING "macos")
elseif(CMAKE_SYSTEM_NAME MATCHES "Windows")
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
set(OS_STRING "win64")
elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
set(OS_STRING "win32")
endif()
elseif(CMAKE_SYSTEM_NAME MATCHES "Linux")
set(OS_STRING "linux_${CMAKE_SYSTEM_PROCESSOR}")
else()
set(OS_STRING ${CMAKE_SYSTEM_NAME}_${CMAKE_SYSTEM_PROCESSOR})
endif()
if (NOT CPACK_PACKAGE_VERSION)
set(CPACK_PACKAGE_VERSION ${CMAKE_PROJECT_VERSION})
endif()
if(NOT BUILD_SHARED_LIBS)
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${OS_STRING}")
else()
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-static-${OS_STRING}")
endif()
set(CPACK_PACKAGE_INSTALL_DIRECTORY ${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION})
set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY OFF)
#Set base Name And Generator Based on the system
if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
set(CPACK_GENERATOR "ZIP")
elseif(CMAKE_SYSTEM_NAME MATCHES "Windows")
set(CPACK_GENERATOR "7Z")
elseif(CMAKE_SYSTEM_NAME MATCHES "Linux")
set(CPACK_GENERATOR "TGZ")
endif()
include(CPack)