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

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包命令记录)