使用 CMake 构建 cpp-netlib
Building cpp-netlib with CMake
我已经下载了 cpp-netlib 源代码,将其解压缩到一个文件夹中,但由于某种原因我完全迷路了。我仔细阅读了文档,它说我也必须下载 CMake,我已经下载了。然后我设置源目录和构建目录,单击 "Generate" 按钮后我得到了这个输出:
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.
我真的不确定现在该做什么,我觉得我的问题还没有结束...有什么明显的我遗漏的吗?
您需要从源代码树(包含 CMakeLists.txt)中 运行 cmake,或者更典型的是,从构建文件夹中 运行 cmake 并告诉它在哪里源树群岛
一个常见的情况是在源代码树旁边创建一个构建文件夹并 运行ning cmake ../sourcedir
.
您似乎最初使用的是图形用户界面;这肯定提供了一种设置 BOOST_ROOT 变量的方法吗?
或者,如果您只是将提升放在 VC++ include/lib 路径中(在 vc 目录中,或通过设置 %INCLUDE%/%LIB%),你可能不需要 BOOST_ROOT。 OpenSSL 也一样。
我已经下载了 cpp-netlib 源代码,将其解压缩到一个文件夹中,但由于某种原因我完全迷路了。我仔细阅读了文档,它说我也必须下载 CMake,我已经下载了。然后我设置源目录和构建目录,单击 "Generate" 按钮后我得到了这个输出:
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.
我真的不确定现在该做什么,我觉得我的问题还没有结束...有什么明显的我遗漏的吗?
您需要从源代码树(包含 CMakeLists.txt)中 运行 cmake,或者更典型的是,从构建文件夹中 运行 cmake 并告诉它在哪里源树群岛
一个常见的情况是在源代码树旁边创建一个构建文件夹并 运行ning cmake ../sourcedir
.
您似乎最初使用的是图形用户界面;这肯定提供了一种设置 BOOST_ROOT 变量的方法吗?
或者,如果您只是将提升放在 VC++ include/lib 路径中(在 vc 目录中,或通过设置 %INCLUDE%/%LIB%),你可能不需要 BOOST_ROOT。 OpenSSL 也一样。