本文首发于个人博客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. Python小工具:利用ffmpy3库3秒钟将视频转换为音频

    作者 | pk 哥 来源公众号 | Python知识圈(ID:PythonCircle) 最近,有读者微信上私聊我,想让我写一篇视频批量转换成音频的文章,我答应了,周末宅家里把这个小工具做出来了. 这 ...

  2. postgresql被注入之后

    本来只是贪便宜买了个一年特价的阿里云服务器,做做测试什么的,结果不知道哪一天开始阿里云安全中心就开始给我发什么安全提示类的信息,一开始我并不在意,因为这些都是套路,不过是想让我升级购买高防盾罢了,反正 ...

  3. .NET手撸2048小游戏

    .NET手撸2048小游戏 2048是一款益智小游戏,得益于其规则简单,又和2的倍数有关,因此广为人知,特别是广受程序员的喜爱. 本文将再次使用我自制的"准游戏引擎"FlysEng ...

  4. eclipse 工具翻译插件安装

    http://download.eclipse.org/technology/babel/update-site/R0.15.1/oxygen

  5. jdk基础配置

    今遇到一事,tomcat启动是报错,将jdk位数错误,有问题,32位和64位的问题 cmd java -verison 显示的确实是jdk 64位,又跑到 环境变量看了下java_home的配置 这里 ...

  6. 关于Map集合注意事项

    今日代码中循环Map时,采用循环主键 Map<Integer,Map<Integer,String>> status =  new HashMap<>(); Set ...

  7. 优化 Git Commit Message

    目前很多项目都是通过 Git 进行管理的,Git 每次提交代码的过程中 提交说明 commit message 是必须的.但仅仅必须是不够的,好的提交说明可以帮助我们提高项目的整体质量. 作用与优点 ...

  8. Jenkins 结合 ANT 发送测试报告

    全局变量配置 点击 ManageJenkins进入Jenkins 管理 点击 Global Tool Configuration 进入全局变量配置 配置 Ant ,Name 自己定义一个比较好理解的名 ...

  9. 暑期集训20190727 水(water)

    [题目描述] 有一块矩形土地被划分成n×m个正方形小块.这些小块高低不平,每一小 块都有自己的高度.水流可以由任意一块地流向周围四个方向的四块地中,但 是不能直接流入对角相连的小块中. 一场大雨后,由 ...

  10. 《Effective Java》 读书笔记(八)避免使用Finalizer和Cleaner机制

    Finalizer和Cleaner并不等同于C++中的析构函数,是不确定多久会被调用的,甚至有时候可能不会被调用,因此除了作为一个安全网或者终止非关键的本地资源,不应该在Finalizer或Clean ...