当前位置:网站首页>CMake installation and testing
CMake installation and testing
2022-07-30 03:46:00 【CAir2】
上篇一文读懂CMakeWe've got the hang of itCMake的脚本编写.An installation, as the name suggests, is to install an application,For example, executables and dynamic libraries will be generated,Copy to the specified installation location.下面是install的基本语法.
安装
install(TARGETS <target>... [...])
install({
FILES | PROGRAMS} <file>... [...])
install(DIRECTORY <dir>... [...])
install(SCRIPT <file> [...])
install(CODE <code> [...])
install(EXPORT <export-name> [...])
#DESTINATION 表示安装位置
#如果设置了CMAKE_INSTALL_PREFIX则表示在CMAKE_INSTALL_PREFIXbase location+DESTINATION
#TARGETS Represents a list of target files 例如可执行文件,库文件
install(TARGETS MathFunctions DESTINATION lib)
#FILES 表示文件列表
install(FILES MathFunctions.h DESTINATION include)
设置完成之后执行cmake --install 目录(cmake的输出目录,Usually the current directory:build)
#执行Cmake
#cmake ../
#编译文件
#cmake --build .
#安装
#cmake --install .
#文件末尾添加
#设置安装目录,linux默认为/usr/local,windows默认为“C:\Program Files (x86)”
set(CMAKE_INSTALL_PREFIX "${PROJECT_BINARY_DIR}/install/")
#Print the current installation directory
install(CODE "message(\"CMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}\")")
#安装指定文件
install(TARGETS hellow DESTINATION bin)

这样安装OK了,但是linux需要注意sosearch rules for,否则可能导致so找不到,Thus the program fails to run.
测试
cmake测试:As the name implies, it verifies the accuracy of the program through different parameters.(centos7没有找到ctest工具).
边栏推荐
- Nacos配置中心
- Monitor page deployment
- Mini Program Graduation Works WeChat Points Mall Mini Program Graduation Design Finished Product (8) Graduation Design Thesis Template
- Nacos installation and deployment
- 路由过滤器
- Advanced Microservices Cloud Alibaba
- Nacos cluster partition
- Mini Program Graduation Works WeChat Points Mall Mini Program Graduation Design Finished Work (7) Interim Inspection Report
- Nacos Configuration Center
- 小程序毕设作品之微信二手交易小程序毕业设计成品(4)开题报告
猜你喜欢

【Use of scientific research tools】A

Gateway 路由网关

Rpc 和 gRpc 简介汇总

组织在线化:组织数字化变革的新趋势

What is the difference between mission, vision and values?

WeChat second-hand transaction small program graduation design finished works (8) graduation design thesis template

小程序毕设作品之微信二手交易小程序毕业设计成品(6)开题答辩PPT

数据湖:数据集成工具DataX

Hystrix 服务熔断

路由过滤器
随机推荐
Summary of Rpc and gRpc Introduction
Rpc 和 gRpc 简介汇总
Nacos命名空间
New interface - API interface for "Taote" keyword search
【无标题】
Mini Program Graduation Works WeChat Second-hand Trading Mini Program Graduation Design Finished Works (5) Task Book
FreeRTOS个人笔记-内存管理
Has been empty, a straightforward, continue to copy the top off!
传输层详解
List获取差集产生的问题
MySQ deadlock
STM32 SPI+WM8978语音回环
Mini Program Graduation Works WeChat Points Mall Mini Program Graduation Design Finished Work (5) Task Book
使命、愿景、价值观到底有什么区别
Anti-shake and throttling
操作配置:如何在一台服务器中以服务方式运行多个EasyCVR程序?
新接口——“淘特”关键词搜索的API接口
Mini Program Graduation Works WeChat Points Mall Mini Program Graduation Design Finished Work (7) Interim Inspection Report
OA项目之待开会议&历史会议&所有会议
Hystrix service circuit breaker