Tool-CMake-CPack
CMakeList.txt:Cpack
project(CpackDemo)
#project(CpackDemo VERSION 0.0.1)
set(CPACK_PACKAGE_NAME XXX)
set(CPACK_PACKAGE_VERSION 0.0.1) #Default value is 0.1.1
set(CPACK_PACKAGE_VERSION_MAJOR 0)# Defalut value is CMAKE_PROJECT_VERSION_MAJOR
set(CPACK_PACKAGE_VERSION_MINOR 0)# Defalut value is CMAKE_PROJECT_VERSION_MINOR
set(CPACK_PACKAGE_VERSION_PATCH 1)# Defalut value is CMAKE_PROJECT_VERSION_PATCH
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Brief")
set(CPACK_PACKAGE_VENDOR "Company")
string(TIMESTAMP TIMESTAMP "%Y-%m-%d_%H-%M-%S")
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${TIMESTAMP}")
set(CPACK_PACKAGE_DIRECTORY ..)
set(CPACK_GENERATOR "TGZ;ZIP")
# 7Z (7-Zip file format)
# DEB (Debian packages)
# External (CPack External packages)
# IFW (Qt Installer Framework)
# NSIS (Null Soft Installer)
# NSIS64 (Null Soft Installer (64-bit))
# NuGet (NuGet packages)
# RPM (RPM packages)
# STGZ (Self extracting Tar GZip compression
# TBZ2 (Tar GZip compression)
# TXZ (Tar XZ compression)
# TZ (Tar Compress compression)
# ZIP (ZIP file format)
#FILE
install(TARGETS xx DESTINATION bin)
install(DIRECTORY xx DESTINATION .)
install(FILES xx DESTINATION .)
#END
include(CPack)
标签:-%,set,CMake,PACKAGE,Tool,VERSION,CPACK,CPack
From: https://www.cnblogs.com/yongchao/p/18289713