cmake

How to link shared library *dll with CMake in Windows

怎甘沉沦 提交于 2020-02-25 23:11:50
问题 I have 2 files: library.dll and library.h with some code that I need in my own project. I'm working on Windows with Clion where I should config this with CMake. I tried this way: cmake_minimum_required(VERSION 3.6) project(test2) set(CMAKE_CXX_STANDARD 11) link_directories(C:\\Users\\Johny\\CLionProjects\\test2) set(SOURCE_FILES main.cpp) add_executable(test2 ${SOURCE_FILES}) target_link_libraries(test2 library.dll) It compiled but didnt work. Returns code -1073741515 How can I handle with it

关于gcc、make和CMake的区别

|▌冷眼眸甩不掉的悲伤 提交于 2020-02-25 21:15:58
CMake是一种跨平台编译工具,比make更为高级,使用起来要方便得多。CMake主要是编写CMakeLists.txt文件,然后用cmake命令将CMakeLists.txt文件转化为make所需要的makefile文件,最后用make命令编译源码生成可执行程序或共享库(so(shared object)).它的作用和qt的qmake是相似的。 作者:辉常哥 链接:https://www.zhihu.com/question/36609459/answer/89743845 来源:知乎 著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。 1.gcc是GNU Compiler Collection(就是GNU编译器套件),也可以简单认为是编译器,它可以编译很多种编程语言(括C、C++、Objective-C、Fortran、Java等等)。 2.当你的程序只有一个源文件时,直接就可以用gcc命令编译它。 3.但是当你的程序包含很多个源文件时,用gcc命令逐个去编译时,你就很容易混乱而且工作量大 4.所以出现了make工具 make工具可以看成是一个智能的批处理工具,它本身并没有编译和链接的功能,而是用类似于批处理的方式—通过调用makefile文件中用户指定的命令来进行编译和链接的。 5.makefile是什么?简单的说就像一首歌的乐谱,make工具就像指挥家

在Ubuntu18.04上安装opencv 3.4.1

三世轮回 提交于 2020-02-25 11:44:07
对于安装opencv有的人一次就成功,而有人安装了N多次才成功。我就是那个安装了N多次的人,每次遇到了很多安装错误,只能通过到网上搜教程资料,解决方法;通过一次次的试错,最终完成了安装。再此提醒第一次安装或则安装失败没有头绪的小伙伴,请注重官方安装教程: https://docs.opencv.org/master/d9/df8/tutorial_root.html 安装环境是:ubuntu 18.04 安装的opencv版本为3.4.1(其他版本也行,安装过程类似) opencv安装的依赖包有: Required Packages GCC 4.4.x or later CMake 2.8.7 or higher Git GTK+2.x or higher, including headers (libgtk2.0-dev) pkg-config Python 2.6 or later and Numpy 1.5 or later with developer packages (python-dev, python-numpy) ffmpeg or libav development packages: libavcodec-dev, libavformat-dev, libswscale-dev [optional] libtbb2 libtbb-dev [optional]

Cannot compile pcl examples with cmake

无人久伴 提交于 2020-02-25 06:47:09
问题 I just got the pcl installed and would like to run the examples in the folder /pcl-pcl-1.7.1/examples. The different examples each have CMakeLists.txt in them, so I thought I just do a cmake . in the terminal followed by make to compile it. After doing that in the terminal I got CMake Warning (dev) in CMakeLists.txt: No cmake_minimum_required command is present. A line of code such as cmake_minimum_required(VERSION 2.8) So I looked into the cmake file and the weird thing is that these cmake

[学习OpenCV攻略][017][ARM9下移植OpenCV]

跟風遠走 提交于 2020-02-25 02:33:04
安装环境 宿主机: Red Hat Enterprise Linux Server 6.3 开发板: mini2440 相关软件: cmake-3.5.1.tar.gz、OpenCV-2.3.1a.tar.bz2 下载地址: CMake: https://cmake.org/files/v3.5/cmake-3.5.1.tar.gz OpenCV: http://downloads.sourceforge.net/project/opencvlibrary/opencv-unix/2.3.1/OpenCV-2.3.1a.tar.bz2 安装过程 CMake安装 说明: CMake是一个跨平台的安装(编译)工具,可以用简单的语句来描述所有平台的安装(编译过程)。用它来产生OpenCV编译时用到的Makefile文件。 步骤: 1.解压 tar xvf cmake-3.5.1.tar.gz cd cmake-3.5.1 2.配置 ./configure --prefix=/usr //生成Makefile,安装位置/usr 3.编译 make //通过Makefile编译源代码 4.安装 make install //文件安装在/usr/路径下 5.测试 cmake //执行cmake命令显示cmake版本号和帮助信息表示安装成功 OpenCV安装 说明:

How to add files to a non-executable or non-library target with CMake

本秂侑毒 提交于 2020-02-24 12:10:26
问题 I understand I can add some files to a target in CMake if the target is an executable or a library with the following command: add_executable(${target_name} ${source_files}) or add_library(${target_name} ${source_files}) Then my question is what if the target is not an an executable or a library. I raise this question because I want to build a target for documentation with Doxygen, and this can be done with the following commands: find_package(Doxygen) if(DOXYGEN_FOUND) set(doxyfile_in $

How to add files to a non-executable or non-library target with CMake

泪湿孤枕 提交于 2020-02-24 12:10:12
问题 I understand I can add some files to a target in CMake if the target is an executable or a library with the following command: add_executable(${target_name} ${source_files}) or add_library(${target_name} ${source_files}) Then my question is what if the target is not an an executable or a library. I raise this question because I want to build a target for documentation with Doxygen, and this can be done with the following commands: find_package(Doxygen) if(DOXYGEN_FOUND) set(doxyfile_in $

Caffe: CMake源码编译(OpenCV4.2+CUDA)

不想你离开。 提交于 2020-02-24 08:47:40
周六周日在家倒腾了两天,总算稍微了解点pycaffe的一些接口和api设置了,但是针对不同层,还是有很多注意的细节的,所以也准备写个博客专门总结pycaffe的常见层参数设置,(LZ这个蠢啊,之前居然手写prototxt,一把辛酸泪,太傻了/(ㄒoㄒ)/~~) 之前已经写过用Anaconda直接安装caffe,这样安装caffe不香嘛, 为啥非得源码再来安装一次呢? 1.项目里后端是用的tensorflow的接口,前端是要用caffe的接口,caffe的有些参数设置还是源码查询比较方便 2.有一些层是比较特殊的,这种定制化的层可能需要使用c写完之后,再进行源码编译 不过源码编译还是有很多坑的,且听LZ一一道来: 首先下载源码, https://github.com/weiliu89/caffe 按照tutorial安装依赖项: http://caffe.berkeleyvision.org/installation.html LZ的小小笔记本是Ubuntu16.04 所以需要先安装对应的依赖库 sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf-compiler sudo apt-get install --no

CMake and Window .Lib Files

我的梦境 提交于 2020-02-24 04:07:07
问题 I have been struggling to find an answer to this question across Stackoverflow, at least one that I understand. I recently bought CLion and want to port an older project from Visual Studio over to it. But I have no idea how to link or add .lib files to my project. I need to link Xinput and DSound. In Visual Studio I just added the headers and then added these to the top of my file #pragma comment(lib, "XInput.lib") #pragma comment(lib, "Dsound.lib") I just have absolutely no idea how to link

CMake building a static library with other static library

☆樱花仙子☆ 提交于 2020-02-23 03:44:18
问题 My problem is as follows : I have OpenSSL as static libraries ( libcrypto.a and libssl.a ). Compiled on Windows with MSys2/MinGW64 . Besides that, I have a small self written library based on OpenSSL . Now I want to "bundle" the Crypto lib from OpenSSL with My lib to a "big" static library for later statically compiling in other applications on Windows without deploying any library. What would a CMakeLists.txt file looks like? And are the prerequisites ( OpenSSL as static libs ) correct?