标签:des style http io ar color os 使用 sp
CPack是CMake 2.4.2之后的一个内置工具,主要作用就是生成制定类型的安装包.它可以脱离cmake单独运行.关于怎么具体作用安装包,请参见pack工程
在cpack中你要掌握的唯一语法就是install, 这个主要就是在制作安装包的过程中调用的
install(TARGETS <targets> [[ARCHIVE|LIBRARY|RUNTIME] [DESTINATION <dir>] [PERMISSIONS <permissions> [Debug|Release..]] [COMPONENT <component>] [OPTIONAL] ][...]) 简单例子: INSTALL(TARGETS myrun mylib mystaticlib RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION libstatic ) 上面的例子会将: 可执行二进制 myrun 安装到${CMAKE_INSTALL_PREFIX}/bin 目录 动态库 libmylib 安装到${CMAKE_INSTALL_PREFIX}/lib 目录 静态库 libmystaticlib 安装到${CMAKE_INSTALL_PREFIX}/libstatic 目录 特别注意的是你不需要关心 TARGETS 具体生成的路径,只需要写上 TARGETS 名称就可以了 |
INSTALL(PROGRAMS files... DESTINATION <dir> [PERMISSIONS permissions...] [CONFIGURATIONS [Debug|Release|...]] [COMPONENT <component>] [RENAME <name>] [OPTIONAL]) 简单例子: install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/control DESTINATION opt/omatrix/bin) 将control安装到/opt/omatrix/bin下 |
INSTALL(FILES files... DESTINATION <dir> [PERMISSIONS permissions...] [CONFIGURATIONS [Debug|Release|...]] [COMPONENT <component>] [RENAME <name>] [OPTIONAL]) |
INSTALL(DIRECTORY dirs... DESTINATION <dir> [FILE_PERMISSIONS permissions...] [DIRECTORY_PERMISSIONS permissions...] [USE_SOURCE_PERMISSIONS] [CONFIGURATIONS [Debug|Release|...]] [COMPONENT <component>] [[PATTERN <pattern> | REGEX <regex>] [EXCLUDE] [PERMISSIONS permissions...]] [...]) 简单例子: install(DIRECTORY tool DESTINATION ${INSTALL_PATH} FILE_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE ) |
install(CODE "EXECUTE_PROCESS(COMMAND cp -r /opt/omatrix/lib ${CMAKE_SOURCE_DIR})" ) install(CODE "execute_process(COMMAND rm -rf ${CMAKE_SOURCE_DIR}/lib/.svn ${CMAKE_SOURCE_DIR}/lib/capture/.svn)" ) |
make package
基本上有了这些就可以制作出你自己的安装包了
标签:des style http io ar color os 使用 sp
原文地址:http://www.cnblogs.com/457220157-FTD/p/4157497.html