CMake报错集锦

一、报错1

bash 复制代码
-bash: pybind11-config: command not found
CMake Error at CMakeLists.txt:33 (find_package):
  By not providing "Findpybind11.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "pybind11",
  but CMake did not find one.

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

    pybind11Config.cmake
    pybind11-config.cmake

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


-- Configuring incomplete, errors occurred!

这类错误经常发送,分两步解决:
第一步:

找到对应的包,以这个为例:

bash 复制代码
sudo find / -name pybind11Config.cmake

然后一般是在python的路径下(因为是python的包),比如这里就找到了:

bash 复制代码
/home/nvidia/venv/lib/python3.6/site-packages/pybind11/share/cmake/pybind11/pybind11Config.cmake

第二步:

CMakeLists.txt文件中的find_package(pybind11 REQUIRED)新增:

set(CMAKE_PREFIX_PATH /home/nvidia/venv/lib/python3.6/site-packages/pybind11)
set(pybind11_DIR /home/nvidia/venv/lib/python3.6/site-packages/pybind11/share/cmake/pybind11/pybind11Config.cmake)

就修改OK了~ 按照之前的CMake命令重新执行即可。

∼ O n e p e r s o n g o f a s t e r , a g r o u p o f p e o p l e c a n g o f u r t h e r ∼ \sim_{One\ person\ go\ faster,\ a\ group\ of\ people\ can\ go\ further}\sim ∼One person go faster, a group of people can go further∼

相关推荐
赵民勇2 天前
cmake中execute_process详解
cmake
凌云行者3 天前
OpenGL入门004——使用EBO绘制矩形
c++·cmake·opengl
长弓聊编程5 天前
应该怎么理解CMakeLists.txt中一些指令的INTERFACE、PUBLIC和PRIVATE参数
cmake
凌云行者5 天前
OpenGL入门003——使用Factory设计模式简化渲染流程
c++·cmake·opengl
凌云行者6 天前
OpenGL入门002——顶点着色器和片段着色器
c++·cmake·opengl
梦起丶7 天前
CMake 生成器表达式介绍
c++·cmake
梦起丶9 天前
CMake 生成器表达式---条件表达式和逻辑运算符
c++·cmake
咩咩大主教11 天前
QtCreator通过CMake多文件编译.cpp、.qss、.h、.ui文件,达到MVC三层架构的效果
c++·qt·cmake·qtcreator·qss·多文件编译·qmake
韦易笑12 天前
Emake:你见过最简单的 C/C++ 构建工具
c++·cmake
winds~17 天前
Cmake中“目标层级“的概念(target_include_directories和include_directories的区别)
c++·cmake