camke使用例程
1 同文件夹直接编译
1 同文件夹直接编译
# cmake needs this line
cmake_minimum_required(VERSION 2.8) # Define project name
project(pixel_Giga) # Find OpenCV, you may need to set OpenCV_DIR variable
# to the absolute path to the directory containing OpenCVConfig.cmake file
# via the command line or GUI
find_package(OpenCV REQUIRED) # If the package has been found, several variables will
# be set, you can find the full list with descriptions
# in the OpenCVConfig.cmake file.
# Print some message showing some of them
message(STATUS "OpenCV library status:")
message(STATUS " version: ${OpenCV_VERSION}")
message(STATUS " libraries: ${OpenCV_LIBS}")
message(STATUS " include path: ${OpenCV_INCLUDE_DIRS}") if(CMAKE_VERSION VERSION_LESS "2.8.11")
# Add OpenCV headers location to your include paths
include_directories(${OpenCV_INCLUDE_DIRS})
endif() # Declare the executable target built from your sources
add_executable(camera1 camera1.cpp openShare.cpp openShare.hpp)
# Link your application with OpenCV libraries
target_link_libraries(camera1 ${OpenCV_LIBS}) # Declare the executable target built from your sources
add_executable(camera2 camera2.cpp openShare.cpp openShare.hpp)
# Link your application with OpenCV libraries
target_link_libraries(camera2 ${OpenCV_LIBS}) # Declare the executable target built from your sources
add_executable(camera3 camera3.cpp openShare.cpp openShare.hpp)
# Link your application with OpenCV libraries
target_link_libraries(camera3 ${OpenCV_LIBS}) # Declare the executable target built from your sources
add_executable(camera4 camera4.cpp openShare.cpp openShare.hpp)
# Link your application with OpenCV libraries
target_link_libraries(camera4 ${OpenCV_LIBS}) # Declare the executable target built from your sources
add_executable(camera5 camera5.cpp openShare.cpp openShare.hpp)
# Link your application with OpenCV libraries
target_link_libraries(camera5 ${OpenCV_LIBS}) # Declare the executable target built from your sources
add_executable(camera6 camera6.cpp openShare.cpp openShare.hpp)
# Link your application with OpenCV libraries
target_link_libraries(camera6 ${OpenCV_LIBS}) # Declare the executable target built from your sources
add_executable(camera7 camera7.cpp openShare.cpp openShare.hpp)
# Link your application with OpenCV libraries
target_link_libraries(camera7 ${OpenCV_LIBS}) # Declare the executable target built from your sources
add_executable(camera8 camera8.cpp openShare.cpp openShare.hpp)
# Link your application with OpenCV libraries
target_link_libraries(camera8 ${OpenCV_LIBS}) # Declare the executable target built from your sources
add_executable(camera9 camera9.cpp openShare.cpp openShare.hpp)
# Link your application with OpenCV libraries
target_link_libraries(camera9 ${OpenCV_LIBS}) # Declare the executable target built from your sources
add_executable(camera10 camera10.cpp openShare.cpp openShare.hpp)
# Link your application with OpenCV libraries
target_link_libraries(camera10 ${OpenCV_LIBS}) # Declare the executable target built from your sources
add_executable(camera11 camera11.cpp openShare.cpp openShare.hpp)
# Link your application with OpenCV libraries
target_link_libraries(camera11 ${OpenCV_LIBS}) # Declare the executable target built from your sources
add_executable(camera12 camera12.cpp openShare.cpp openShare.hpp)
# Link your application with OpenCV libraries
target_link_libraries(camera12 ${OpenCV_LIBS}) # Declare the executable target built from your sources
add_executable(dispose1 dispose1.cpp openShare.cpp openShare.hpp)
# Link your application with OpenCV libraries
target_link_libraries(dispose1 ${OpenCV_LIBS})
2 同文件夹多个编译
CMakeLists.txt
cmake_minimum_required(VERSION 2.6)
project(tcp) #自动连接模式 #1将文件夹下全部文件链接到 src
#aux_source_directory(. src)
#将src里面的所有文件链接用于生成可执行文件
#add_executable(project1 ${src}) #手动添加模式
#1测试-生成可执行文件main
add_executable(main src/main.cpp) add_executable(client src/client.cpp) add_executable(Server src/Server.cpp) add_executable(http_client src/http_client.cpp) #设置可执行文件的输出目录
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
src源码地址
可执行文件夹
3 分文件夹间接编译
CMakeLists.txt
#1工程名字
PROJECT(main)
#2版本要求
CMAKE_MINIMUM_REQUIRED(VERSION 2.6) #3-1该命令会把参数 <.当前文件夹> 中所有的源文件名称赋值给参数 <DIR_SRCS>
AUX_SOURCE_DIRECTORY(. DIR_SRCS)
#3-2包含src文件夹下的内容,会自动到该文件夹下寻找新的cmake
ADD_SUBDIRECTORY( src ) #0 指示变量 DIR_SRCS 中的源文件需要编译 成一个名称为 main 的可执行文件。
ADD_EXECUTABLE(main ${DIR_SRCS}) #-1 链接库
TARGET_LINK_LIBRARIES( main Test )
main.cpp
#include <iostream>
using namespace std;
#include "src/print_drc.cpp"
#include "src/print_src.cpp" int main()
{ print_drc();
print_src(); cout<<"hello world"<<endl;
return 1;
}
CMakeLists.txt
#3-1该命令会把参数 <.当前文件夹> 中所有的源文件名称赋值给参数 <DIR_TEST1_SRCS>
AUX_SOURCE_DIRECTORY(. DIR_TEST1_SRCS) #0 指示变量 DIR_SRCS 中的源文件需要编译 成一个名称为 main 的可执行文件。
#ADD_EXECUTABLE(main ${DIR_SRCS})
#0 指示变量 DIR_TEST1_SRCS 中的源文件需要编译 成一个名称为 main 的库。
ADD_LIBRARY ( Test ${DIR_TEST1_SRCS})
print_drc.cpp
#include <iostream> using namespace std; int print_drc()
{
cout<<"1 这是来自直接目录下的测试!"<<endl;
return 1;
}
print_src.cpp
#include <iostream> using namespace std; int print_src()
{
cout<<" 2 这是来自src下的测试!"<<endl;
return 1;
}
编译
cmake .. make
运行
camke使用例程的更多相关文章
- (转)linux下和云端通讯的例程, ubuntu和openwrt实验成功(一)
一. HTTP请求的数据流总结#上传数据, yeelink的数据流如下POST /v1.0/device/4420/sensor/9089/datapoints HTTP/1.1Host: api. ...
- Socket编程实践(3) 多连接服务器实现与简单P2P聊天程序例程
SO_REUSEADDR选项 在上一篇文章的最后我们贴出了一个简单的C/S通信的例程.在该例程序中,使用"Ctrl+c"结束通信后,服务器是无法立即重启的,如果尝试重启服务器,将被 ...
- Socket编程实践(2) Socket API 与 简单例程
在本篇文章中,先介绍一下Socket编程的一些API,然后利用这些API实现一个客户端-服务器模型的一个简单通信例程.该例子中,服务器接收到客户端的信息后,将信息重新发送给客户端. socket()函 ...
- C#做有模和非模式化窗体 传值例程
有模窗体:指的是一定要在第二个窗体上操作之后 才能去操作前者窗体 :例如,如果一个对话框,在可以切换到其它窗体或对话框之前要求先单击"确定"或"取消",则它就是 ...
- Delphi容器类之---TList、TStringList、TObjectList,以及一个例程的代码分析
转载自:http://blog.csdn.net/jqandjq/article/details/5429137 看了这里标题,大家可能以为我会谈TListBox控件,那就错了.我要谈的是Delphi ...
- IRP完成例程返回值理解
第一,完成例程里面直接返回STATUS_SUCCESS,这时候IRP已经继续向上回卷,失去了对IRP的控制. 第二,完成例程里面返回STATUS_MORE_PROCESSING_REQUIRED,仍具 ...
- [汇编与C语言关系]2. main函数与启动例程
为什么汇编程序的入口是_start,而C程序的入口是main函数呢?以下就来解释这个问题 在<x86汇编程序基础(AT&T语法)>一文中我们汇编和链接的步骤是: $ as hell ...
- ORA-12523: TNS: 监听程序无法找到适用于客户机连接的例程
今天使用PL/SQL Developer连接到一台新的测试服务器时,遇到ORA错误:ORA-12523: TNS: 监听程序无法找到适用于客户机连接的例程.对应的监听日志文件里面错误为TNS-1252 ...
- Qt 之 入门例程 (一)
以 “Hello Qt” 为例,介绍如何建立一个 Qt 工程 . 1 QLabel 例程 QLabel 继承自 QFrame (继承自 QWidget),主要用来显示文本和图片. 1.1 Hell ...
随机推荐
- Git学习(二)Git命令
1.创建新的git仓库 初始化一个Git仓库,使用git init命令. 上图中我们新建了目录/home/honey/cxf,并进入目录cxf执行命令git init完成新git仓库的初始化,初始化成 ...
- jQuery 练习:取出数组字典的值, 静态对话框, clone方法应用
jQuery 中文API文档 http://jquery.cuishifeng.cn/ jQuery 取出数组字典的值 <head> <meta charset="UTF- ...
- iOS------Xcode 的clang 扫描器可以检测出所有的内存泄露吗
在苹果没有出ARC(自动内存管理机制)时,我们几乎有一半的开发时间都耗费在这么管理内存上.后来苹果很人性的出了ARC,虽然在很大程度上,帮助我们开发者节省了精力和时间.但是我们在开发过程中,由于种种原 ...
- Android为TV端助力 转载:android MVC设计模式
Controller控制器 import android.app.Dialog; import android.app.ProgressDialog; import android.os.Bundle ...
- Android为TV端助力 自定义通知栏
package com.example.mvp; import cn.ljuns.temperature.view.TemperatureView;import presenter.ILoginPre ...
- eclipse安装其他颜色主题包
eclipse安装其他颜色主题包: 用Help-Install new software安装的时候,work with的URL是 http://eclipse-color-theme.github.c ...
- 简单的Array.sort 排序方法
[排序]sort类 Arrays.sort升序排序 import java.util.Arrays;//导入Arrays类public class menu{ public static voi ...
- CSS布局---居中方法
在web页面布局中居中是我们常遇到的情况,而居中分为水平居中与垂直居中 文本的居中 CSS中对文本的居中做的非常友好,我们是需要text-align, line-height 两个属性就可以控制文本的 ...
- MySQL状态变量Aborted_connects与Aborted_clients浅析
关于MySQL的状态变量Aborted_clients & Aborted_connects分别代表的意义,以及哪些情况或因素会导致这些状态变量变化呢?下文通过实验测试来验证一下,首先我们来看 ...
- Oracle EBS compile PLD PLL files.
PLL->PLX:frmcmp_batch module_type=library userid=apps/apps module=$1.pll output_file=$1.plx compi ...