0

我已经下载了 cpp-netlib 源,将其解压缩到一个文件夹中,但由于某种原因,我完全迷失了。我仔细阅读了文档,它说我也必须下载 CMake,我确实这样做了。然后我设置源目录和构建目录,单击“生成”按钮后,我得到了以下输出:

The CXX compiler identification is MSVC 19.0.23506.0
Check for working C compiler using: Visual Studio 14 2015
Check for working C compiler using: Visual Studio 14 2015 -- works
Detecting C compiler ABI info
Detecting C compiler ABI info - done
Check for working CXX compiler using: Visual Studio 14 2015
Check for working CXX compiler using: Visual Studio 14 2015 -- works
Detecting CXX compiler ABI info
Detecting CXX compiler ABI info - done
Detecting CXX compile features
Detecting CXX compile features - done
CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.5/Modules/FindBoost.cmake:1657 (message):
  Unable to find the requested Boost libraries.

  Unable to find the Boost header files.  Please set BOOST_ROOT to the root
  directory containing Boost or BOOST_INCLUDEDIR to the directory containing
  Boost's headers.
Call Stack (most recent call first):
  CMakeLists.txt:49 (find_package)


Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR (missing:  OPENSSL_LIBRARIES OPENSSL_INCLUDE_DIR) 
Looking for pthread.h
Looking for pthread.h - not found
Found Threads: TRUE  
CMake Error at CMakeLists.txt:131 (export):
  export given target "cppnetlib-client-connections" which is not built by
  this project.


Configuring incomplete, errors occurred!
See also "C:/Users/Nick/Documents/cpp-netlib/cpp-netlib-build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/Nick/Documents/cpp-netlib/cpp-netlib-build/CMakeFiles/CMakeError.log"

它找不到 Boost 库,这就是我卡住的地方。我安装了 boost,但我不知道在哪里设置“BOOST_ROOT”。我对此进行了一些研究,尝试使用带有如下-DBOOST_ROOT选项的命令行:

c:\Program Files>cmake -DBOOST_ROOT=/boost/boost_1_55_0

但它给了我以下错误:

CMake Error: The source directory "C:/Program Files" does not appear to contain
CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.

我真的不确定现在该做什么,我觉得这不是我的问题的结束......我有什么明显的遗漏吗?

4

1 回答 1

1

您需要从源代码树(将包含 CMakeLists.txt)运行 cmake,或者更典型地,从构建文件夹运行它并告诉它源代码树在哪里。一个常见的情况是在源代码树旁边创建一个构建文件夹并运行cmake ../sourcedir.

您似乎最初使用的是 gui;这肯定提供了一种设置 BOOST_ROOT 变量的方法吗?

或者,如果您只是将 boost 放在 VC++ 包含/lib 路径中(在 vc 目录中,或通过设置 %INCLUDE%/%LIB%),您可能不需要 BOOST_ROOT。与 OpenSSL 相同。

于 2016-05-01T20:35:04.233 回答