这是我为生产级项目编写cmake文件的第一次尝试,我只是尝试使用cmake找到boost python(v 1.67.0)软件包。
我有一个很小的CMakeLists.txt
。
cmake_minimum_required(VERSION 3.13)
find_package(Boost 1.67.0 REQUIRED COMPONENTS system python37)
if(Boost_FOUND)
message("Boost_FOUND")
endif()
如果我只是尝试找到system
,它会很好,但是当我添加python37
时,它会失败。根据FindBoost documentation,我需要以提及的方式提及它。这是我得到的输出:
CMake Error at /usr/share/cmake-3.13/Modules/FindBoost.cmake:2100 (message):
Unable to find the requested Boost libraries.
Boost version: 1.67.0
Boost include path: /usr/include
Could not find the following Boost libraries:
boost_python37
Some (but not all) of the required Boost libraries were found. You may
need to install these additional Boost libraries. Alternatively, set
BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT
to the location of Boost.
Call Stack (most recent call first):
CMakeLists.txt:2 (find_package)
-- Configuring incomplete, errors occurred!
运行$ locate libboost_python
时,得到以下输出:
/usr/lib/x86_64-linux-gnu/libboost_python-py27.so.1.65.1
/usr/lib/x86_64-linux-gnu/libboost_python27.so.1.67.0
/usr/lib/x86_64-linux-gnu/libboost_python3-py37.so.1.65.1
/usr/lib/x86_64-linux-gnu/libboost_python37.so.1.67.0
鉴于此输出,我假设存在软件包/库。
因此,我尝试在CMakeLists.txt
中添加以下行:
set(BOOST_LIBRARYDIR "/usr/lib/x86_64-linux-gnu")
但是错误仍然存在。我在这里想念什么?
答案 0 :(得分:0)
由于没有/usr/lib/x86_64-linux-
gnu / libboost_python27.so
修复:
apt-get install libboost-python1.67-dev