编程语言
首页 > 编程语言> > cmake cpack 安装打包程序

cmake cpack 安装打包程序

作者:互联网

//set(CPACK_GENERATOR "TGZ")
7Z(.7z)
7Zzip(.7z)
TBZ2(tar.bz2)
TGZ(.tar.gz)
TXZ(.tar.xz)
TZ(.tar.Z)
ZIP(.zip)
###install
install(FILES [FileName]
    DESTINATION [InstallFoldName]
    )
install(TARGETS [ExeName] [LibName] 
    RUNTIME DESTINATION bin
    LIBRARY DESTINATION lib
    ARCHIVE DESTINATION lib
    )

###cpack
execute_process(
        COMMAND git log -1 --format=%h
        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
        OUTPUT_VARIABLE vGitCommit
        OUTPUT_STRIP_TRAILING_WHITESPACE
)
string(TIMESTAMP vTimeStamp "%Y%m%d%H%M%S")

set(CPACK_GENERATOR "TGZ")
set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${vGitCommit}-${vTimeStamp}")

include(CPack)
//run.sh
make package

标签:set,cmake,tar,TGZ,DESTINATION,install,CPACK,cpack,打包
来源: https://www.cnblogs.com/smallredness/p/10938194.html