[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 ...
随机推荐
- [转]C结构体之位域(位段)
有些信息在存储时,并不需要占用一个完整的字节, 而只需占几个或一个二进制位.例如在存放一个开关量时,只有0和1 两种状态, 用一位二进位即可.为了节省存储空间,并使处理简便,C语言又提供了一种数据结构 ...
- mac php项目除了首页全飘not found
1.httpd.conf配置文件中加载了mod_rewrite.so模块2.AllowOverride None 将None改为 All DocumentRoot "/Library/Web ...
- 阿里云服务器+宝塔环境+LNMP+tp5.1安装和调试
1.首先肯定得有个阿里云服务器,楼主是用来自己测试用得,所以就买了个1年得突发性实例,虽然网上都说别买这种,不过个人测试还是没有多少要求得 2.买了服务器之前可以顺带买个域名,再顺带去备案一下,阿里云 ...
- lua虚拟机概述
何为虚拟机 用于模拟计算机运行的程序.是个中间层,它处于脚本语言和硬件之间的一个程序.每一门脚本语言都会有自己定义的opcode("操作码"),可以理解为这门程序自己定义的&quo ...
- plsql分页
分页是任何一个网站(bbs,网上商城,blog)都会使用到的技术,因此学习pl/sql编程开发就一定要掌握该技术.如下图: 1. 编写无返回值的存储过程 首先是掌握最简单的存储过程,无返回值的存储过 ...
- Oracle Database Link 连接数据库复制数据
--1. 创建dblink连接 create database link mdm66 connect to lc019999 identified by aaaaaa using '10.24.12. ...
- AWK高端功能-数组
第1章 awk命令基础 1.1 awk命令执行过程 1.如果BEGIN 区块存在,awk执行它指定的动作. 2.awk从输入文件中读取一行,称为一条输入记录.如果输入文件省略,将从标准输入读取 3.a ...
- 通过切换iframe来定位元素(用于Python+selenium自动化测试)
切换 iframe:1.由于登录按钮是在iframe上,所以第一步需要把定位器切换到iframe上2.用switch_to_frame方法切换,此处有id属性,可以直接用id定位切换 iframe 与 ...
- 统计学习方法c++实现之二 k近邻法
统计学习方法c++实现之二 k近邻算法 前言 k近邻算法可以说概念上很简单,即:"给定一个训练数据集,对新的输入实例,在训练数据集中找到与这个实例最邻近的k个实例,这k个实例的多数属于某个类 ...
- 利用workbench对linux/Ubuntu系统中的mysql数据库进行操作
在上一篇文章中,我分享了在linux中如何安装mysql数据库,但是这只是安装了mysql的服务,并没有图形化管理界面,所以这样子操作起来并没有那么方便,那么现在我们就来实现如何利用在window中安 ...