本文首发于个人博客https://kezunlin.me/post/281dd8cd/,欢迎阅读!

guide to compile and install poco cpp library on ubuntu 16.04

Series

Guide

apt-get

install by apt-get, but we can not use find_package(Poco) because no /usr/local/lib/cmake/Poco/PocoConfig.cmake installed.

sudo apt-get install libpoco-doc libpoco-dev

compile from source

wget https://pocoproject.org/releases/poco-1.8.1/poco-1.8.1.tar.gz

#Install dependences
sudo apt-get install openssl libssl-dev
sudo apt-get install libiodbc2 libiodbc2-dev
sudo apt-get install libmysqlclient-dev cd poco-1.8.1
#sudo ./configure --omit=Data/ODBC,Data/MySQL --no-tests --no-samples --shared
cd build
cmake-gui ..
sudo make -j8
sudo make install

OK. we install headers to /usr/local/include/Poco and libraries to /usr/local/lib/

$ ls /usr/local/libPoco*.so 

/usr/local/lib/libPocoFoundation.so  /usr/local/lib/libPocoNet.so   /usr/local/lib/libPocoXML.so
/usr/local/lib/libPocoJSON.so /usr/local/lib/libPocoUtil.so

we install cmake files to /usr/local/lib/cmake/Poco

$ ls /usr/local/lib/cmake/Poco

PocoConfig.cmake                     PocoJSONTargets.cmake          PocoUtilTargets.cmake
PocoConfigVersion.cmake PocoJSONTargets-release.cmake PocoUtilTargets-release.cmake
PocoFoundationConfig.cmake PocoNetConfig.cmake PocoXMLConfig.cmake
PocoFoundationConfigVersion.cmake PocoNetConfigVersion.cmake PocoXMLConfigVersion.cmake
PocoFoundationTargets.cmake PocoNetTargets.cmake PocoXMLTargets.cmake
PocoFoundationTargets-release.cmake PocoNetTargets-release.cmake PocoXMLTargets-release.cmake
PocoJSONConfig.cmake PocoUtilConfig.cmake
PocoJSONConfigVersion.cmake PocoUtilConfigVersion.cmake

Example

CMakeLists.txt

cmake_minimum_required (VERSION 2.6)

project (event_demo)
enable_language(C)
enable_language(CXX) # Always include the source and build directories in the include path.
set(CMAKE_INCLUDE_CURRENT_DIR ON) # Set the output folder where your program will be created
set(CMAKE_BINARY_DIR ${CMAKE_SOURCE_DIR}/bin)
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR})
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}) # Find Poco package 1.8.1
find_package(Poco REQUIRED COMPONENTS Foundation Util Net XML JSON) # no Poco_INCLUDE_DIRS, we have to set by hand
if(MSVC) # WIN32
SET(Poco_INCLUDE_DIRS "C:/Program Files/Poco/include")
else()
SET(Poco_INCLUDE_DIRS "/usr/local/include/Poco")
endif(MSVC) MESSAGE( [Main] " Poco_INCLUDE_DIRS = ${Poco_INCLUDE_DIRS}")
MESSAGE( [Main] " Poco_LIBRARIES = ${Poco_LIBRARIES}") # The following folder will be included
include_directories(
${MY_SRC_INCLUDE}
${Poco_INCLUDE_DIRS}
) link_directories(${CMAKE_BINARY_DIR}) add_executable(event_demo event_demo.cpp)
target_link_libraries(event_demo ${Poco_LIBRARIES})

Reference

History

  • 20180222: created.

Copyright

Ubuntu 16.04上源码编译Poco并编写cmake文件 | guide to compile and install poco cpp library on ubuntu 16.04的更多相关文章

  1. Ubuntu 16.04上源码编译和安装pytorch教程,并编写C++ Demo CMakeLists.txt | tutorial to compile and use pytorch on ubuntu 16.04

    本文首发于个人博客https://kezunlin.me/post/54e7a3d8/,欢迎阅读最新内容! tutorial to compile and use pytorch on ubuntu ...

  2. ubuntu 16.04上源码编译glog和gflags 编写glog-config.cmake和gflags-config.cmake | compile glog and glags on ubuntu 16.04

    本文首发于个人博客https://kezunlin.me/post/977f5125/,欢迎阅读! compile glog and glags on ubuntu 16.04 Series comp ...

  3. ubuntu 16.04上源码编译和安装cgal并编写CMakeLists.txt | compile and install cgal on ubuntu 16.04

    本文首发于个人博客https://kezunlin.me/post/39ab7ed9/,欢迎阅读最新内容! compile and install cgal on ubuntu 16.04 Guide ...

  4. [Windows篇] 在windows 10上源码编译gtest 并编写CMakeLists.txt

    本文首发于个人博客https://kezunlin.me/post/aca50ff8/,欢迎阅读! compile gtest on windows 10 Guide compile gtest on ...

  5. ubuntu 16.04上源码编译dlib教程 | compile dlib on ubuntu 16.04

    本文首发于个人博客https://kezunlin.me/post/c6ead512/,欢迎阅读! compile dlib on ubuntu 16.04 Series Part 1: compil ...

  6. ubuntu 16.04上源码编译opengv | compile opengv on ubuntu 16.04

    本文首发于个人博客https://kezunlin.me/post/1e5d14ee/,欢迎阅读! compile opengv on ubuntu 16.04 Series compile open ...

  7. ubuntu 16.04上源码编译libjpeg-turbo和使用教程 | compile and use libjpeg-turbo on ubuntu 16.04

    本文首发于个人博客https://kezunlin.me/post/9f626e7a/,欢迎阅读! compile and use libjpeg-turbo on ubuntu 16.04 Seri ...

  8. ubuntu 14.04上源码编译安装php7

    wget https://downloads.php.net/~ab/php-7.0.0alpha2.tar.bz2 //用winscp把下载好的文件上传到网站中 tar jxf php-7.0.0a ...

  9. [Ubuntu篇] 在ubuntu上源码编译gtest,编写gtest-config.cmake并测试

    本文首发于个人博客https://kezunlin.me/post/4a1427cf/,欢迎阅读! compile gtest on ubuntu 16.04 Guide compile gtest ...

随机推荐

  1. 开源造轮子:一个简洁,高效,轻量级,酷炫的不要不要的canvas粒子运动插件库

    一:开篇 哈哈哈,感谢标题党的莅临~ 虽然标题有点夸张的感觉,但实际上,插件库确实是简洁,高效,轻量级,酷炫酷炫的咯.废话不多说,先来看个标配例子吧: (codepen在线演示编辑:http://co ...

  2. 使用 Hexo,Material Theme 以及 Github Pages 搭建个人博客

    准备条件 Node.js npm Git GitHub账号 开始搭建 hexo init Blog cd Blog npm install hexo-deployer-git --save npm i ...

  3. Qt 表格的使用

    参考 http://doc.qt.io/qt-5/qtablewidget.html http://doc.qt.io/qt-5/qtablewidgetitem.html https://blog. ...

  4. 从零开始把项目发布到maven仓库中心

    sonatype准备操作 注册账号 https://issues.sonatype.org 1. 密码符号规范,并且工记住 新建项目 1. group id 如果你有com域名的所有权可以直接使用,如 ...

  5. Element filtername is not allowed here-web.xml version="3.0"-intellij idea

    Element filtername is not allowed here-web.xml version="3.0"-intellij idea Intellij IDEA 报 ...

  6. js控制进度条数据

    <style><!-- #time{ width:500px; height: 20px; background: red; border-radius: 10px; } --> ...

  7. PHP通过JSON给JS赋值;JS通过JSON给PHP传值

    $fileNames = array(); // 是数组,不是字符串 $filesJSON = json_encode($fileNames);// 转成json格式 var oldFiles = n ...

  8. Scrapy 框架入门简介

    一.Scrapy框架简介 Scrapy 是用 Python 实现的一个为了爬取网站数据.提取结构性数据而编写的应用框架. Scrapy 常应用在包括数据挖掘,信息处理或存储历史数据等一系列的程序中. ...

  9. Java 数据类型和初始值

    Java 基本数据类型 byte.short.int.long.float.double.boolean.char byte 数据类型是8位.有符号的,以二进制补码表示的整数 short 数据类型是 ...

  10. Web for pentester_writeup之Code injection篇

    Web for pentester_writeup之Code injection篇 Code injection(代码注入) Example 1 <1> name=hacker' 添加一个 ...