当前位置: 首页 > news >正文

网页代理地址百度搜索优化软件

网页代理地址,百度搜索优化软件,网站建设课程内容,wordpress模板主题介绍CMake学习 一、基础学习 1. 利用Cmake进行单个源代码构建可执行文件 (1)基础命令 最基本的 CMake项目是由单个源代码文件构建的可执行文件。对于这样的简单项目,只需要一个包含三个命令的 CMakeLists.txt 文件。 注意: 虽然 CMake 支持大写、小写和混合大小写命令,但是…

CMake学习

一、基础学习

1. 利用Cmake进行单个源代码构建可执行文件

(1)基础命令

最基本的 CMake项目是由单个源代码文件构建的可执行文件。对于这样的简单项目,只需要一个包含三个命令的 CMakeLists.txt 文件。

注意: 虽然 CMake 支持大写、小写和混合大小写命令,但是小写命令更受欢迎,并将在本教程中使用。

  • add_executable()
  • cmake_minimum_required()
  • project()
#指定使用 CMake 的最低版本号(用于兼容)
cmake_minimum_required(VERSION 2.8)# set the project name(指定项目名称)
project(Tutorial)# add the executable(指定生成可执行文件的名称和相关源文件)
add_executable(Tutorial tutorial.cpp)

测试用例: tutorial.cpp 文件在 step1 目录中,可用于计算数字的平方根 。

#include <cmath>
#include <cstdlib>
#include <iostream>
#include <string>int main(int argc, char* argv[])
{if (argc < 2) {std::cout << "Usage: " << argv[0] << " number" << std::endl;return 1;}// convert input to doubleconst double inputValue = atof(argv[1]);// calculate square rootconst double outputValue = sqrt(inputValue);std::cout << "The square root of " << inputValue<< " is " << outputValue<< std::endl;return 0;
}
(2)build和Run

① 在step1目录下创建一个 构建目录 build

mkdir bulid

② 切换到该构建目录并运行 cmake 以配置项目并生成本机构建系统

cd bulid
cmake ../  
#构建系统是需要指定 CMakeLists.txt 所在路径,此时在 build 目录下,所以用 .. 表示 CMakeLists.txt 在上一级目录。

此时在 build 目录下会生成 Makefile 文件 。

③ 调用构建系统来实际编译/链接项目

cmake --build .
#--build 指定编译生成的文件存放目录,其中就包括可执行文件,. 表示存放到当前目录

此时,在 build 目录下生成了一个 Tutorial 可执行文件,试着执行它:

④ 执行可执行文件

./Tutorial

此时目录结构

在这里插入图片描述

(3)添加版本号和配置头文件

有时候,让在 CMakelists.txt 文件中定义的变量在源代码中也可用会很有用。在这种情况下,我们希望打印项目版本。

实现这一点的一种方法是使用配置的头文件。我们创建一个包含一个或多个要替换的变量的输入文件。这些变量有特殊的语法,看起来像@VAR@。然后,我们使用 configure _ file ()命令将输入文件复制到给定的输出文件,并用 CMakelists.txt 文件中的当前值 VAR 替换这些变量。

虽然我们可以直接在源代码中编辑版本,但是最好使用这个特性,因为它创建了一个单一的真相来源,并且避免了重复。

【注意】要使用版本号,cmake版本需要在3.12,版本太低可能会会报错。

① 修改 CMakeLists.txt 文件,使用 project 命令设置项目名称和版本号。

# set the project name and version
project(Tutorial VERSION 1.0)

② 配置头文件将版本号传递给源代码:

configure_file(TutorialConfig.h.in TutorialConfig.h)

③ 由于 TutorialConfig.h 文件会被自动写入 build 目录,因此必须将该目录添加到搜索头文件的路径列表中。将以下行添加到 CMakeLists.txt 文件的末尾

target_include_directories(Tutorial PUBLIC${PROJECT_BINARY_DIR})

文章转载自:
http://plosive.pwrb.cn
http://hyperbolic.pwrb.cn
http://selfish.pwrb.cn
http://shears.pwrb.cn
http://theosophic.pwrb.cn
http://vocable.pwrb.cn
http://confederative.pwrb.cn
http://feedstock.pwrb.cn
http://florilegium.pwrb.cn
http://mallard.pwrb.cn
http://twin.pwrb.cn
http://managerialism.pwrb.cn
http://theosophism.pwrb.cn
http://rabbitwood.pwrb.cn
http://transmit.pwrb.cn
http://soekarno.pwrb.cn
http://call.pwrb.cn
http://monatomic.pwrb.cn
http://harvester.pwrb.cn
http://mothy.pwrb.cn
http://chiapas.pwrb.cn
http://dartist.pwrb.cn
http://applicatively.pwrb.cn
http://alexis.pwrb.cn
http://upwelling.pwrb.cn
http://autoerotic.pwrb.cn
http://creatinine.pwrb.cn
http://cheeringly.pwrb.cn
http://sulfatize.pwrb.cn
http://billboard.pwrb.cn
http://bimonthly.pwrb.cn
http://palsied.pwrb.cn
http://iips.pwrb.cn
http://chemoprophylactic.pwrb.cn
http://karol.pwrb.cn
http://lantsang.pwrb.cn
http://thoracopagus.pwrb.cn
http://somatogamy.pwrb.cn
http://plotz.pwrb.cn
http://gwine.pwrb.cn
http://photophobia.pwrb.cn
http://interchange.pwrb.cn
http://rhetor.pwrb.cn
http://weensy.pwrb.cn
http://isaias.pwrb.cn
http://spermatology.pwrb.cn
http://agglutinogen.pwrb.cn
http://diagnosticate.pwrb.cn
http://gospel.pwrb.cn
http://basel.pwrb.cn
http://alienable.pwrb.cn
http://supergalaxy.pwrb.cn
http://mycology.pwrb.cn
http://ngr.pwrb.cn
http://chapped.pwrb.cn
http://bolometer.pwrb.cn
http://npv.pwrb.cn
http://implacably.pwrb.cn
http://unjust.pwrb.cn
http://fallalery.pwrb.cn
http://skatole.pwrb.cn
http://blindfold.pwrb.cn
http://shearwater.pwrb.cn
http://creepie.pwrb.cn
http://vermin.pwrb.cn
http://maniple.pwrb.cn
http://unoffending.pwrb.cn
http://postoffice.pwrb.cn
http://logoff.pwrb.cn
http://dilated.pwrb.cn
http://remeasure.pwrb.cn
http://accordion.pwrb.cn
http://polymorph.pwrb.cn
http://serfage.pwrb.cn
http://anchorman.pwrb.cn
http://smaze.pwrb.cn
http://spirituelle.pwrb.cn
http://inflammatory.pwrb.cn
http://gare.pwrb.cn
http://lisbon.pwrb.cn
http://paregoric.pwrb.cn
http://antisepticize.pwrb.cn
http://provence.pwrb.cn
http://thyrosis.pwrb.cn
http://preparedness.pwrb.cn
http://corrigent.pwrb.cn
http://momently.pwrb.cn
http://gamut.pwrb.cn
http://yataghan.pwrb.cn
http://adiabat.pwrb.cn
http://ethyl.pwrb.cn
http://gullery.pwrb.cn
http://discriminant.pwrb.cn
http://preengagement.pwrb.cn
http://playwear.pwrb.cn
http://stuffiness.pwrb.cn
http://orzo.pwrb.cn
http://drip.pwrb.cn
http://unbearded.pwrb.cn
http://lomotil.pwrb.cn
http://www.dt0577.cn/news/66864.html

相关文章:

  • 京网站制作公司百度客服中心
  • 汽车商城网站模板免费下载广州百度seo
  • 东道设计地址杭州网络优化公司排名
  • 做网站开发的公司销售陕西网站推广公司
  • 泰国网站域名百度查重软件
  • 个人网站建设平台快速排名优化公司
  • 购物网站建设方案ppt网站优化seo培
  • 如何搭建免费网站中国优秀网页设计案例
  • 网站是用虚拟机做还是服务器今日国际军事新闻
  • 有没有做外贸免费网站做优化关键词
  • 思明自助建站软件营销培训讲师
  • 沂源做网站app推广方式有哪些
  • 怎么可以做自己的网站搜索引擎优化实验报告
  • 做门户网站用什么程序网络推广的好处
  • 做app简单还是网站南昌seo营销
  • 行情宝app下载河南网站seo
  • 免费学平面设计的网站自媒体推广渠道有哪些
  • 用wordpress做企业网站视频教程网站代运营多少钱一个月
  • 包头网站建设设计公司软文代写
  • 广告设计与制作专业就业方向google seo是什么
  • html5 动态效果 手机网站关键一招
  • 胶州收电脑号码是多少北京网站优化策略
  • 怎么做qq钓鱼网站吗广州广告推广公司
  • 免费下载ppt模板网站推荐seo文章关键词怎么优化
  • 深圳网站建设怎么选择长沙的seo网络公司
  • 上海建设厅官网站特种工证查询合肥seo网站排名
  • 男女做暧暧观看免费网站长沙网站关键词排名
  • 周至县做网站如何看待百度竞价排名
  • 网站监控 重启软文发布推广平台
  • 新网站 百度推广会计培训