当前位置:网站首页>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工具).
边栏推荐
- Ansible introduction (detailed) features + advantages + design concept + application field + system architecture + working principle + task execution process
- SQLSERVER将子查询数据合并拼接成一个字段
- 微服务CAP原则
- 淘宝/天猫获得淘宝店铺详情 API
- route filter
- NLP Natural Language Processing (1)
- Mini Program Graduation Works WeChat Second-hand Trading Mini Program Graduation Design Finished Works (3) Background Functions
- Mini Program Graduation Works WeChat Points Mall Mini Program Graduation Design Finished Products (1) Development Overview
- LoadBalancer load balancing
- SDL播放器实战
猜你喜欢

小程序毕设作品之微信积分商城小程序毕业设计成品(6)开题答辩PPT

spicy(一)基本定义

Smart answer function, CRMEB knowledge payment system must have!

Introduction to management for technical people 1: What is management

Mini Program Graduation Works WeChat Second-hand Trading Mini Program Graduation Design Finished Work (2) Mini Program Function

【Use of scientific research tools】A

小程序毕设作品之微信积分商城小程序毕业设计成品(1)开发概要

小程序毕设作品之微信积分商城小程序毕业设计成品(5)任务书

Mini Program Graduation Works WeChat Second-hand Trading Mini Program Graduation Design Finished Works (3) Background Functions

Monitor page deployment
随机推荐
智能答题功能,CRMEB知识付费系统必须有!
Advanced Microservices Cloud Alibaba
小程序毕设作品之微信积分商城小程序毕业设计成品(8)毕业设计论文模板
Tcp programming
微服务CAP原则
26 basic models in 6 categories that operators must master
【Use of scientific research tools】A
监控页面部署
sql中 exists的用法
Gateway 路由网关
论坛管理系统
spicy(二)unit hooks
Send it to your friends and let TA treat you to fried chicken!
Mini Program Graduation Works WeChat Points Mall Mini Program Graduation Design Finished Products (6) Question Opening and Defense PPT
un7.29: How to install and configure redis in Linux-centos?
Summary of Rpc and gRpc Introduction
【Node访问MongoDB数据库】
Testers, what else do you need to know besides testing?
SQL 入门之第一讲——MySQL 8.0.29安装教程(windows 64位)
Nacos集群分区