CMake第三方库安装 [英] CMake third-party library installation

查看:521
本文介绍了CMake第三方库安装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是编程新手。对于我的研究项目,我需要安装用于CMake的第三方库( GitHub项目)。

I'm new in programming. And for my study project I need to install a third-party library for using with CMake (GitHub project).

我在PC上使用Arch OS。通常,我在〜/ aur 中构建所有非存储库软件包。 CMake版本是3.17。

I use Arch OS on my PC. Usually I build all non-repository packages in: ~/aur. CMake version is 3.17.

然后我尝试根据说明构建一个库:

Then I try to build a library according to the instructions:

...
cmake --config Debug "-DCMAKE_BUILD_TYPE=Debug" ..

这使我出错:

CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
PNG_INCLUDE_DIR
   used as include directory in directory /home/wizki/aur/P0267_RefImpl/P0267_RefImpl/Tests

-- Generating done
CMake Generate step failed.  Build files cannot be regenerated correctly.

如果我忽略此错误并使用以下命令构建此库:

If I ignore this error and build this library using:

cmake --build .

建筑物是成功的,但在durin我的项目建筑物中,我有一个错误:

The building is succesful, but durin my project building I have an error:

CMake Error at CMakeLists.txt:15 (find_package):
  By not providing "Findio2d.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "io2d", but
  CMake did not find one.

Could not find a package configuration file provided by "io2d" with any of
  the following names:

    io2dConfig.cmake
    io2d-config.cmake

Add the installation prefix of "io2d" to CMAKE_PREFIX_PATH or set
"io2d_DIR" to a directory containing one of the above files.  If "io2d"
provides a separate development package or SDK, be sure it has been
installed.

-- Configuring incomplete, errors occurred!

在网络搜索之后,我尝试了以下解决方案: Daniweb
libpng和zlib软件包已安装; FindPNG.cmake存在于 /usr/share/cmake-3.17/Modules / 中。
但我的 $ CMAKE_INCLUDE_PATH $ CMAKE_LIBRARY_PATH 为空:

After a web search I've tried this solution: Daniweb. libpng and zlib packages are installed; FindPNG.cmake exists in /usr/share/cmake-3.17/Modules/. But my $CMAKE_INCLUDE_PATH and $CMAKE_LIBRARY_PATH are empty:

[wizki@evix Debug]$ echo $CMAKE_INCLUDE_PATH

[wizki@evix Debug]$ echo $CMAKE_LIBRARY_PATH

我尝试在FindPNG.cmake中搜索路径,但没有结果。从 CMake Wiki 中,我想其中一个库路径是 / usr / lib 。我曾尝试在内部建立一个库,但遇到了同样的问题。

I've tried to search in FindPNG.cmake for paths, but no result. From CMake wiki I suppose that one of the library path is /usr/lib. I've tried to build a library inside, but I have a same issue.

接下来我可以尝试什么?

What can I try next?

推荐答案

假设您正在研究有关Udacity的C ++纳米学位项目。我陷入了同样的问题,我发现在IO2D的安装过程中,您在终端机中执行了以下命令

Assuming you are studying for the C++ Nanodegree Project on Udacity. I was stuck on the same issue and I found out that during the installation of IO2D after you execute the following command in the terminal

cmake --build . 

执行以下命令

sudo make install

这将在Cmake可以复制的地方复制必要的文件找到它们。

this will copy the necessary files at places where Cmake can find them.

因此,完整的过程如下:

Therefore, the complete process looks like this

git clone --recurse-submodules https://github.com/cpp-io2d/P0267_RefImpl
cd P0267_RefImpl
mkdir Debug
cd Debug
cmake --config Debug "-DCMAKE_BUILD_TYPE=Debug" ..
cmake --build .
sudo make install

我在这里找到了解决方案- https://github.com/udacity/CppND-Route-Planning-Project/issues/ 1#issuecomment-569472612

I found the solution here - https://github.com/udacity/CppND-Route-Planning-Project/issues/1#issuecomment-569472612

PS:由于您是编程的新手,我想分享一个提示,很多其他人也遇到同样的问题,并且可以在GitHub存储库的问题标签中找到解决方案。

PS: As you are new to programming I would like to share a tip that many times other people also have the same issue and it is easier to find a solution in the "Issues" tab of a GitHub repo.

这篇关于CMake第三方库安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆