我是编程新手。对于我的研究项目,我需要安装第三方库以用于CMake(GitHub project)。
我在PC上使用Arch OS。通常,我在〜/ aur 中构建所有非存储库软件包。 CMake版本是3.17。
然后我尝试根据说明构建一个库:
...
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.
如果我忽略此错误并使用以下命令构建此库:
cmake --build .
该建筑物成功,但是在我的项目建筑物中,我遇到了一个错误:
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 是空的:
[wizki@evix Debug]$ echo $CMAKE_INCLUDE_PATH
[wizki@evix Debug]$ echo $CMAKE_LIBRARY_PATH
我尝试在FindPNG.cmake中搜索路径,但没有结果。在CMake wiki中,我假设库路径之一是 / usr / lib 。我试图在内部建立一个库,但是有一个相同的问题。
接下来我可以尝试什么?
答案 0 :(得分:1)
假设您正在研究有关Udacity的C ++纳米学位项目。我陷入了同样的问题,我发现在IO2D的安装过程中,您在终端机中执行以下命令
cmake --build .
执行以下命令
sudo make install
这会将所需的文件复制到Cmake可以找到它们的地方。
因此,完整的过程如下:
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
PS:作为您的编程新手,我想分享一个提示,很多其他人也遇到同样的问题,并且可以在GitHub存储库的“问题”选项卡中找到解决方案。