当前位置:网站首页>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工具).
边栏推荐
- 小程序毕设作品之微信二手交易小程序毕业设计成品(3)后台功能
- 小程序毕设作品之微信二手交易小程序毕业设计成品(6)开题答辩PPT
- Sentinel Traffic Guard
- Mini Program Graduation Works WeChat Points Mall Mini Program Graduation Design Finished Products (1) Development Overview
- sublime text 3 设置
- Send it to your friends and let TA treat you to fried chicken!
- LoadBalancer 负载均衡
- 朴素贝叶斯分类
- 小程序毕设作品之微信积分商城小程序毕业设计成品(1)开发概要
- spicy(二)unit hooks
猜你喜欢

Mini Program Graduation Works WeChat Points Mall Mini Program Graduation Design Finished Work (7) Interim Inspection Report

day10--install mysql on linux

EasyNVR平台级联到EasyCVR,视频播放一会就无法播放是什么原因?

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

Nacos配置中心

Nacos 安装与部署

Nacos service registration and discovery

传统项目转型

Has been empty, a straightforward, continue to copy the top off!

What is the difference between mission, vision and values?
随机推荐
Nacos集群分区
OpenFeign实现负载均衡
Mini Program Graduation Works WeChat Second-hand Trading Mini Program Graduation Design Finished Works (7) Interim Inspection Report
朴素贝叶斯分类
一起来学习flutter 的布局组件
HCIP OSPF
MySQ deadlock
CMake的安装和测试
sqlmap使用教程大全命令大全(图文)
Uptime Monitoring: How to Ensure Network Device Uptime
如何有效进行回顾会议(上)?
CDH/CDP 是什么?
Nacos 安装与部署
状态空间表示
Overview of Federated Learning (2) - Classification, Framework and Future Research Directions of Federated Learning
OPENSQL
Mini Program Graduation Works WeChat Points Mall Mini Program Graduation Design Finished Product (2) Mini Program Function
Mini Program Graduation Works WeChat Second-hand Trading Mini Program Graduation Design Finished Works (3) Background Functions
FreeRTOS Personal Notes - Memory Management
day10--install mysql on linux