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∼

相关推荐
雪域迷影12 小时前
Windows上使用VS2026和CMake编译LearnOpenGL项目源代码
windows·cmake·opengl·vs2026·gthub
瞎折腾啥啊4 天前
CMake FetchContent与ExternalProject
c++·cmake·cmakelists
JMchen1235 天前
集成第三方 C/C++ 库到 Android NDK 项目:OpenCV 与 FFmpeg 实战指南
opencv·ffmpeg·音视频开发·cmake·jni·ndk·abi 兼容性
郝学胜-神的一滴6 天前
从零起步:CMake基础入门与实战跨平台编译
c++·软件工程·软件构建·cmake
AlbertS7 天前
distcc + ccache 编译递归问题排查总结
c++·cmake·gcc·g++·distcc·ccache
Robot_Nav10 天前
CMake、Ament 与 Catkin:ROS 构建系统的前世今生
ros·cmake
CoderMeijun14 天前
CMake 入门笔记
c++·笔记·编译·cmake·构建工具
郝学胜-神的一滴14 天前
墨韵技术|CMake:现代项目构建的「行云流水」之道
c++·程序人生·软件工程·软件构建·cmake
H Journey15 天前
C++之 CMake、CMakeLists.txt、Makefile
开发语言·c++·makefile·cmake
H Journey17 天前
VSCode下CMake使用
vscode·cmake