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∼

相关推荐
羑悻的小杀马特3 天前
现代 CMake 项目构建完全指南:从基础配置到高级技巧的目标属性管理与智能依赖传递机制解析
cmake·项目构建·属性传递机制
Theliars8 天前
Ubuntu 上使用 VSCode 调试 C++ (CMake 项目) 指南
c++·vscode·ubuntu·cmake
Molesidy21 天前
【Embedded System】【CMake】Windows下CMake+VSCode的开发环境搭建以及初步认识
ide·vscode·编辑器·cmake
fedorayang1 个月前
precompilation-headers 以及在cmake中的实现
cmake
AAA小肥杨1 个月前
cmake使用教程
c语言·c++·cmake
辰尘_星启1 个月前
『CMake』关于使用CMake构建项目时的现代/传统指令
c++·架构·系统·cmake·项目·构建
安全二次方security²1 个月前
TF-A CMake构建系统
编译·cmake·atf·tf-a·arm安全架构·构建系统
玩转C语言和数据结构1 个月前
CMake下载和安装图解(附安装包,适合新手)
cmake·cmake下载·cmake安装·cmake 下载·cmake 安装·安装cmake·cmake下载安装
周之鸥1 个月前
Qt 项目国际化从零到一:用 Qt Linguist 实现多语言动态切换(含源码与踩坑指南)
qt·i18n·cmake·qmake·linguist·lupdate·lrelease
老黄编程1 个月前
ros2 中 CMakeLists.txt 的 ament_package 有什么用?有什么使用约束?必须放置尾部吗?
ros·cmake