[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 ...
随机推荐
- js中css样式兼容各个浏览器写法
在实际业务中往往需要在js中对dom添加一些样式,还需要对各个浏览器厂商的兼顾,看到一位大神写的一个方法很赞,做一个笔记 function prefixStyle(style){ var eleSty ...
- mariadb密码问题
错误信息: Mysql:ERROR 1698 (28000): Access denied for user 'root'@'localhost' 解决办法: sudo cat /etc/mysql/ ...
- Spring整合MyBatis(三)sqlSessionFactory创建
摘要: 本文结合<Spring源码深度解析>来分析Spring 5.0.6版本的源代码.若有描述错误之处,欢迎指正. 目录 一.SqlSessionFactoryBean的初始化 二.获取 ...
- [shell]关闭超时的进程
应同事要求,写了个shell, 主要功能为查找超时的进程,并关闭! 调用方式: shell_sheep : 为进程名 30 : 为30分钟 从打印的日志能看出会多两个PID,不要惊慌,由于你执行时会 ...
- [转]使用CallerMemberName简化InotifyPropertyChanged的实现
原文:https://www.cnblogs.com/TianFang/p/3381484.html 在WPF中,当我们要使用MVVM的方式绑定一个普通对象的属性时,界面上往往需要获取到属性变更的通知 ...
- .Net Core使用Unity替换原生DI
原文:.Net Core使用Unity替换原生DI 一.DIP.IOC.DI 面对对象设计原则可以帮助我们开发出更好的程序,其中有一个依赖倒置原则DIP并由此引申出IOC.DI等概念.就先粗略的了解一 ...
- c++ 预处理和多重替换
预处理概念 #include #define extern 一. 预处理概念 在源代码编译成机器指令之前,都要进行预处理. 预处理阶段一般会在编译之前处理和修改C源代码.完成预处理后预 ...
- QTableWidget具体解释(样式、右键菜单、表头塌陷、多选等) (非代理)
在公司公示Qt开发一段时间,表格用到不少,所以,今天在这做个总结,防止以后忘记. 下面为个人模拟Windows资源管理器的一个表单.(写的比較粗糙,谅解一下) 一.设置表单样式 table_widge ...
- MIUI 10 已连接 但无法访问互联网 的解决方案
wifi为 DHCP 时,我发现得到的总是已经有机器在用的 192.168.1.9 这台机器, 所以只需要手动配置一下ip就行了,随便指定一个,然后ping一下,ping不通的话就配上,然后再重新连 ...
- virtualenvwrapper安装和常用指令(mac)
安装: .安装(要有python环境+pip): * sudo pip install virtualenvwrapper .配置: 执行:vi ~/.bash_profile 在~/.bash_pr ...