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 010 :一步到位链接静态库
开发语言·c++·qt·程序人生·系统架构·cmake
草莓熊Lotso6 天前
【CMake】 工程实战:可执行文件从编译、链接到安装全流程深度拆解
linux·运维·服务器·网络·c++·cmake
明月_清风10 天前
Makefile 完全指南:从入门到 CMake 工程化实践
后端·cmake
yuanyuan2o212 天前
从最小项目开始的 CMake 教程
c语言·开发语言·arm开发·c++·makefile·make·cmake
瞎折腾啥啊15 天前
VCPKG详细使用教程
linux·c++·cmake·cmakelists
郝学胜-神的一滴18 天前
跨平台动态库与头文件:从原理到命名的深度解析
linux·c++·程序人生·unix·cmake
吃鱼鱼鱼19 天前
CMakeListsc常用路径详解
cmake
瞎折腾啥啊21 天前
vcpkg与CMake
linux·c++·cmake·cmakelists
众少成多积小致巨22 天前
Cmake 入门指南
cmake
瞎折腾啥啊23 天前
现代 CMake 目标系统
c++·cmake·cmakelists