CmakeLists实践(2)
来源:互联网 发布:个人收支软件app 编辑:程序博客网 时间:2024/05/19 02:21
多个源文件在同一级目录
有main.cpp、Multiply.h和Multiply.cpp3个文件
文件结构
—main.cpp
—Multiply.h
—Multiply.cpp
—CMakeLists.txt
main.cpp的代码如下:
#include<iostream>#include"Multiply.h"using namespace std;int main(){ int a,b; cin>>a>>b; Multiply mul; cout<<mul.multiply(a,b)<<endl;}
Multiply.h的代码如下:
#ifndef _Multiply_H_#define _Multiply_H_class Multiply{public: Multiply(); ~Multiply(); int multiply(int a, int b);};#endif
Multiply.cpp的代码如下:
#include"Multiply.h"Multiply::Multiply(){ ;}Multiply::~Multiply(){ ;}int Multiply::multiply(int a, int b){ return a*b;}
CMakeLists.txt的代码编写:
# CMake最低版本要求cmake_minimum_required (VERSION 2.8)# 项目信息project(Demo2)# 查找当前目录下的所有源文件,并将名称保存到 DIR_SRCS 变量aux_source_directory(. DIR_SRCS)# 指定生成的目标add_executable(Demo ${DIR_SRCS})
0 0
- CmakeLists实践(2)
- CmakeLists实践(1)
- CmakeLists实践(3)
- CmakeLists实践(4)
- cmakelists
- CMakeLists
- CMakeLIsts
- ROS学习(六):CMakeLists.txt 文件
- 《Cmake 实践》【初试 cmake – cmake 的 helloworld】CMakeLists.txt错误
- AndroidStudio2.2NDK CMakeLists.txt配置新的.cpp
- AndroidStudio2.2NDK CMakeLists.txt配置新的.cpp
- 【学习cmake】CMake的CMakeLists.txt剖析-2
- ROS CMakeLists.txt的编写学习(一)
- ROS之catkin介绍(CMakeLists.txt 、package.xml)
- Android 使用CMake编译NDK(一)CMakeLists.txt
- 阅读 CMakeLists
- CMakelists.txt
- CMakeLists 文件
- 微信开发--开发模式简单配置
- Kafka 0.10 SocketServer源代码分析
- Mybatis如何配置generator代码生成器插件
- 字符串问题(一)
- cc2640官方demo更新连接参数service-CCservice
- CmakeLists实践(2)
- Effective Java读书笔记八:序列化(74-78)
- HBase Shell 常用命令及例子
- Hanoi 塔问题
- PostgreSQL学习第十四篇 listen与notify
- play framework学习笔记之Model类的使用及JPA entity manager
- 【BZOJ 3505】[Cqoi2014]数三角形 组合数学
- Apache Commons工具集简介
- 项目开发纪要,为了提高开发效率和质量