[cmake] Basic Tutorial
Basic Project
The most basic porject is an executable built from source code file.
CMakeLists.txt
cmake_minimum_required (version 2.6)
project (Tutorial)
add_executable(Tutorial tutorial.cxx)
tutorial.cxx
#include <stdio.h> int main(int argc, char* argv[])
{
fprintf(stdout, "hello world");
return ;
}
Project files:
.
├── CMakeLists.txt
└── tutorial.cxx
Upper, lower, and mixed case cammonds are supported by CMake.
Adding a library
├── CMakeLists.txt
├── MathFunctions
│ ├── CMakeLists.txt
│ ├── MathFunctions.h
│ └── mysqrt.cxx
└── tutorial.cxx
In MathFunctions/CMakeLists.txt
add_library(MathFunctions mysqrt.cxx)
add_library: create a library, static or dynamic library.
In ./CMakeList.txt
cmake_minimum_required (VERSION 2.6)
project (Tutorial) # add the binary tree to the search path for include files
# so that we will find TutorialConfig.h
include_directories ("${PROJECT_BINARY_DIR}")
include_directories ("${PROJECT_SOURCE_DIR}/MathFunctions") add_subdirectory (MathFunctions) # add the executable
add_executable (Tutorial tutorial.cxx)
target_link_libraries (Tutorial MathFunctions)
include_directories: to find the header files
add_executable: to create executable
target_link_libraries: add the library to the executable
Reference:
[cmake] Basic Tutorial的更多相关文章
- Ogre学习笔记Basic Tutorial 前四课总结
转自:http://blog.csdn.net/yanonsoftware/article/details/1011195 OGRE Homepage:http://www.ogre3d.org/ ...
- Ogre1.8.1 Basic Tutorial 6 - The Ogre Startup Sequence
原文地址:http://www.ogre3d.org/tikiwiki/tiki-index.php?page=Basic+Tutorial+6&structure=Tutorials 1. ...
- [转]Open Data Protocol (OData) Basic Tutorial
本文转自:http://www.odata.org/getting-started/basic-tutorial/ Basic Tutorial The Open Data Protocol (ODa ...
- [转载] CMake Official Tutorial——教程还是官方的好
CMake官方教程传送门:https://cmake.org/cmake-tutorial/ 以下的内容跟官方教程基本一致,少数地方根据自己的测试有所改动: A Basic Starting Poin ...
- Mule ESB-Content-Based Routing Tutorial(2)
承接 Mule ESB-Content-Based Routing Tutorial(1) 五.执行应用程序 完毕创建,配置.并保存你的新的应用程序,您就能够在嵌入Mule的server上执行(包含 ...
- Deep Learning Tutorial - Classifying MNIST digits using Logistic Regression
Deep Learning Tutorial 由 Montreal大学的LISA实验室所作,基于Theano的深度学习材料.Theano是一个python库,使得写深度模型更容易些,也可以在GPU上训 ...
- Windows 下使用 MinGW 和 CMake 进行开发
CMake 是个非常棒的项目管理工具,这已经是毋庸置疑的. 一些小工具需要在 win 下开发,所以今天探索使用 MinGW 和 CMake 在 win 下的搭配使用.简单做记录. MinGW 使用 Q ...
- 【转载】Ogre:Beginner Tutorial 1: SceneNode, Entity,和SceneManager 结构
原文:Beginner Tutorial 1: SceneNode, Entity,和SceneManager 结构 先决条件 这个教程假设你有C++编程的基础并且可以配置并编译OGRE应用程序 ...
- ROS教程
Learning ROS 学习ROS Depending on your learning style and preferences, you can take two approaches to ...
随机推荐
- P1474 货币系统 Money Systems
题目描述 母牛们不但创建了它们自己的政府而且选择了建立了自己的货币系统.由于它们特殊的思考方式,它们对货币的数值感到好奇. 传统地,一个货币系统是由1,5,10,20 或 25,50, 和 100的单 ...
- 1350: To Add Which? (优先队列+贪心 或者 数组模拟)
1350: To Add Which? Submit Page Summary Time Limit: 1 Sec Memory Limit: 128 Mb Submitt ...
- jQuery----JQuery动画(hide()和show())(下)
本文是对hide()和show()的进一步补充,其中不仅介绍回调函数,还有递归的相关知识点. 案例要求: 点击”隐藏动画“按钮,四个头像从后向前,每个以0.8秒的速度消失 点击”显示动画“按钮,四个头 ...
- ruby puts, print, p方法比较
1.puts([obj[, obj2[, ....]]] ) 依次将obj和换行符输出到$>.若没有参数的话则只会输出换行符. 若参数是数组,则依次输出数组元素和换行符.若将既非数组又非字符串的 ...
- 利用phar实行php反序列化命令执行(测试环境复现)
测试环境的过程大概是:构成出来的phar文件,并修改为任意后缀上传至服务器.通过index.php中存在的文件操作函数参数可控,把参数设置为 phar://上传文件名 即可导致命令执行. index. ...
- Vivado中xilinx_BRAM IP核使用
Vivado2017.2 中BRAM版本为 Block Memory Generator Specific Features 8.3 BRAM IP核包括有5种类型: Single-port RA ...
- matplotlib雷达图
用matplotlib画雷达图,网上流传的版本其实都是官网的一个例子.但是那个例子太复杂,而且它封装了几个类,让人难以一眼看出其本质. 我给出一个简单的解决方法,没有任何封装.作本文的原因,是为了回答 ...
- Install-Package:QRCoder已拥有为System.Drawing.Common定义的依赖项
error_log PM> Install-Package QRCoder -Version 1.3.3 Install-Package : "QRCoder"已拥有为&qu ...
- kali下操作 Apache2
Linux系统为Ubuntu 一.Start Apache 2 Server /启动apache服务 # /etc/init.d/apache2 start or $ sudo /etc/init.d ...
- MySQL中类型后面的数字含义
形式:类型(m) 1.整数型的数值类型已经限制了取值范围,有符号整型和无符号整型都有,而M值并不代表可以存储的数值字符长度,它代表的是数据在显示时显示的最小长度,当存储的字符长度超过M值时,没有任何的 ...