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
上一篇:mongodb安装使用


下一篇:EXSI6.5忘记root密码