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∼

相关推荐
羑悻的小杀马特5 天前
CMake 全流程开发实战:从零开始掌握C++项目构建、测试到一键分发的完整解决方案
c++·cmake
UnnamedOrange9 天前
ROS1 配置代码覆盖率
c++·cmake
UnnamedOrange10 天前
ROS2 配置 linter 的代码格式化工具为 clang-format
c++·cmake
眠りたいです13 天前
基于脚手架微服务的视频点播系统-界面布局部分(二):用户界面及系统管理界面布局
c++·qt·ui·微服务·云原生·架构·cmake
assibe13 天前
cmake基本语法结构
数据库·c++·cmake
charlee4414 天前
CMake构建学习笔记25-SpatiaLite库的构建
cmake·nmake·构建·spatialite
charlee4415 天前
CMake构建学习笔记24-使用通用脚本构建PROJ和GEOS
cmake·构建·proj·geos
charlee4416 天前
CMake构建学习笔记23-SQLite库的构建
sqlite·动态库·cmake·构建
charlee4420 天前
CMake构建学习笔记22-libxml2库的构建
cmake·构建·libxml2
charlee4422 天前
CMake构建学习笔记21-通用的CMake构建脚本
cmake·powershell·构建