Point FindBoost CMAKE提升python Windows 10,与2017年相比

Point FindBoost CMAKE提升python Windows 10,与2017年相比,boost,cmake,visual-studio-2017,boost-python,Boost,Cmake,Visual Studio 2017,Boost Python,我的高层次目标是使用Visual Studio 2017在Windows 10上安装需要python boost的。我使用cmake 3.9.0从源代码处编译了opencv和boost 1.64.0。在为BGSLIBRARY制作的过程中 $ cmake -DBGS_PYTHON_SUPPORT=ON -DBOOST_ROOT="C:/Program Files/boost_1_64_0/" .. -- BGSLIBRARY WITH PYTHON SUPPORT: ON -- OpenCV li

我的高层次目标是使用Visual Studio 2017在Windows 10上安装需要python boost的。我使用cmake 3.9.0从源代码处编译了opencv和boost 1.64.0。在为BGSLIBRARY制作的过程中

$ cmake -DBGS_PYTHON_SUPPORT=ON -DBOOST_ROOT="C:/Program Files/boost_1_64_0/" ..
-- BGSLIBRARY WITH PYTHON SUPPORT: ON
-- OpenCV library status:
--     version: 3.3.0
CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.9/           Modules/FindBoost.cmake:1877 (message):
  Unable to find the requested Boost libraries.

  Boost version: 1.64.0

  Boost include path: C:/Program Files/boost_1_64_0

  Could not find the following Boost libraries:

          boost_python

  No Boost libraries were found.  You may need to 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:75 (find_package)
我在cmake findboost模块上看到了很多问题。好的,让我们从这里开始

我下载并解压缩了boost 1.64.0,并将其放在这里 我运行bootstrap.bat和.b2生成构建提升

C:\Program Files\boost\u 1\u 64\u 0>b2 toolset=msvc-14.1-使用python-user-config=user-config.jam

使用用户配置

import toolset : using ;
using msvc : 14.1 ;
using python 
  : 2.7  # Version
  : C:\\Python27\\python.exe  # Interpreter
  : C:\\Python27\\include  # inc dir
  : C:\\Python27\\libs  # link libs
  : # conditions
  ;
我可以在这里看到python源代码

并且可以确认,在Visual Studio 2017命令提示符中,我使用python支持构建了boost,它成功地找到了所有目标

我可以在这里看到一堆python.lib文件。阅读其他问题表明,这就是问题所在

但我似乎无法让cmake看到它。 我尝试将libboost_python的名称改为boost_python。我试着用cmake-DBOOST\u ROOT或-DBOOST\u LIBRARYDIR或non-debg-BOOST\u LIBRARYDIR来表示。我已经尝试添加到lib dir to PATH。但似乎什么都不管用。这是一个cmake问题、不完整的boost安装还是BGSLibrary的问题

编辑

为了回答“乌托邦”,有问题的CMakeList部分如下

if(BGS_PYTHON_SUPPORT)
set(Boost_USE_STATIC_LIBS OFF)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)

find_package(Boost REQUIRED COMPONENTS python)
find_package(PythonLibs REQUIRED)

message(STATUS "Boost library status:")
message(STATUS "    version: ${Boost_VERSION}")
message(STATUS "    libraries: ${Boost_LIBRARIES}")
message(STATUS "    include path: ${Boost_INCLUDE_DIRS}")

message(STATUS "Python library status:")
message(STATUS "    version: ${PYTHON_VERSION}")
message(STATUS "    libraries: ${PYTHON_LIBRARIES}")
message(STATUS "    include path: ${PYTHON_INCLUDE_DIRS}")
恩迪夫

这是否意味着.lib应该按字面意思命名为python.lib?没有其他字符或boost_python.lib。有那么具体吗


@乌托邦让我找到了正确的解决方案。.lib需要按字面意思命名为boost_python.lib,而不是附加visual studio编译器版本、boost版本等。在这之后,我能够成功构建,不需要cmake标志。

您还没有显示正在使用的find_包。此处所需的组件名称是python not boost_python.Edited to add cmakelist.txt节