美文网首页
CMake生成动态库、RPM包命令记录

CMake生成动态库、RPM包命令记录

作者: lpcarl | 来源:发表于2019-10-31 15:12 被阅读0次
    PROJECT(roi)
    set(CMAKE_INSTALL_PREFIX "/usr/local/libroi/")
    CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
    
    
    AUX_SOURCE_DIRECTORY(/home/carl/pclib/ DIR_SRCS)
    #ADD_EXECUTABLE(libroi ${DIR_SRCS})
    
    
    #set(CMAKE_CXX_FLAG "-pthread")
    #target_link_libraries(main /home/carl/桌面/sendrtmp/librtmp/librtmp.a)
    #add_subdirectory(./librtmp)
    #include_directories(./librtmp)
    #link_libraries(pthread)
    #link_directories(/home/carl/桌面/sendrtmp/librtmp)
    
    ADD_LIBRARY(roi SHARED ${DIR_SRCS}) 
    set_target_properties(roi PROPERTIES  PUBLIC_HEADER "/home/carl/pclib/roi.h;/home/carl/pclib/linpc.h")
    
    install(TARGETS roi 
        RUNTIME DESTINATION bin
        LIBRARY DESTINATION lib
        ARCHIVE DESTINATION lib
        PUBLIC_HEADER DESTINATION include
    )
    
    set(CPACK_SET_DESTDIR ON) 
    set(CPACK_PACKAGE_NAME "libpc")
    set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "libpc")
    set(CPACK_PACKAGE_VENDOR "libpc")
    set(CPACK_PACKAGE_VERSION "1.0.0")
    set(CPACK_PACKAGE_VERSION_MAJOR "1")
    set(CPACK_PACKAGE_VERSION_MINOR "0")
    set(CPACK_PACKAGE_VERSION_PATCH "0")
    set(CPACK_RPM_PACKAGE_GROUP "libpc")
    set(CPACK_RPM_PACKAGE_URL "https://www.xmhouse.xyz")
    set(CPACK_RPM_PACKAGE_DESCRIPTION "linpc")
    set(CPACK_PACKAGE_RELEASE 1)
    set(CPACK_RPM_PACKAGE_LICENSE "libpc")
     
    # 设置默认生成器,RPM生成器会构建RPM安装包,其它还有TGZ/ZIP等
    set(CPACK_GENERATOR "RPM")
     
    # 安装前和安装后执行的shell脚本, 会打包到RPM中,安装时执行。这里可扩展性很强, 放在源码目录下即可
    # set(CPACK_RPM_PRE_INSTALL_SCRIPT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/pre_script.sh)
    # set(CPACK_RPM_POST_INSTALL_SCRIPT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/post_script.sh)
    
    include(CPack)
    
    #查看包描述
    rpm -qip libpc-1.0.0-Linux.rpm
    #查看包中文件
    rpm -qlp libpc-1.0.0-Linux.rpm
    

    相关文章

      网友评论

          本文标题:CMake生成动态库、RPM包命令记录

          本文链接:https://www.haomeiwen.com/subject/nxrtbctx.html