[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 ...
随机推荐
- SVN服务器安装与本地连接
SVN服务器安装与本地连接 系统环境 Centos7 查看是否安装了低版本SVN [root@svn-server ~]# rpm -qa subversion 卸载旧版本SVN [root@svn- ...
- 一个简单好用的http服务器
http-server 是一个简单的零配置命令行HTTP服务器, 基于 nodeJs. 如果你不想重复的写 nodeJs 的 web-server.js, 则可以使用这个. 安装 (全局安装加 -g) ...
- 单片机C程序优化
单片机C程序优化 对程序进行优化,通常是指优化程序代码或程序执行速度.优化代码和优化速度实际上是一个予盾的统一.一般是优化了代码的尺寸,就会带来执行时间的增加:如果优化了程序的执行速度,通常会带来代码 ...
- nginx负载均衡及配置
nginx负载均衡及配置 1 负载均衡概述 负载均衡由来是因为当一台服务器单位时间内的访问量很大时,此时服务器的压力也会很大,当超过自身承受能力时,服务器就会崩溃.为避免让服务器崩溃,用户拥有更好的体 ...
- iview的Affix插件遇到滚动时候的bug处理方法
最近有个需求,是用vue做的页面,其中嵌入了一个tinymce编辑器,编辑器设置了自动调整高度,也就是说编辑器中内容越多,高度就会自动撑高 我们需要再页面最下方放一个保存按钮,保存按钮必须固定在屏幕下 ...
- CodeIgniter Doctrine2基本使用(一)(转)
CodeIgniter Doctrine2基本使用(一) 之前写了一篇文章叫作<CodeIgniter 3.0整合Doctrine2>里面介绍了一些简单的Doctrine2的用法,当然我也 ...
- JavaWeb基础—MVC与三层架构
一.MVC的概念 MVC模式(Model–view–controller)是软件工程中的一种软件架构模式,把软件系统分为三个基本部分:模型(Model).视图(View)和控制器(Controller ...
- 不能存在多个@ManyToMany(fetch=FetchType.EAGER)
@LazyCollection(LazyCollectionOption.FALSE) 原地址:https://stackoverflow.com/questions/4334970/hibernat ...
- 关于manacher
由一个题引入: 求一个串A的最长回文串: A=abababa最长回文串长度:5(ababa) 先思考用hash怎么做? 一.暴力 枚举左端,右端点(确定一个区间),线性扫一遍当前区间. Ans=max ...
- Gitlab+Jenkins学习之路(十)之Jenkins按角色授权和Pipeline
一.Jenkins按角色授权 当一个公司的开发分为多个组别,或者是多个项目等等.用于公司内部测试,让开发人员自行构建测试,此时不可能让所有的开发都在公用一个构建,这样变得很混乱,为了解决这一问题,je ...