5

我正在尝试用 cmake 编译 cpp-netlib。

我的配置:OS X 10.9.1 Mavericks + Xcode 5.0.2 cpp-netlib 0.11.0 cmake 2.8.12.2 Boost 1.55.0

因为我试图让整个事情与 OS X 和 iOS 7 一起工作,所以我使用以下脚本制作了一个 Boost 框架: https ://github.com/mgrebenets/boost-xcode5-iosx

我做了一个没有 c++11 的全新安装,例如:“$ ./boost.sh clean -v 1.55.0”

这产生了两个“boost.framework”目录,一个用于 OS X,第二个用于 iOS。我已经成功地将 OS X Boost 框架添加到我的 Xcode 项目中的“Build Phases > Link Binary With Libraries”中,并测试了 Boost 文档中的 boost::regex 示例,该示例在我的 Mac 上运行良好。

但是,当我开始制作 cpp-netlib 时,我遇到了问题。当我尝试运行它时:

$ cmake -DCMAKE_BUILD_TYPE=调试 -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ ../cpp-netlib-0.11.0-final/

它产生以下输出:

-- The C compiler identification is Clang 5.0.0
-- The CXX compiler identification is Clang 5.0.0
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/g++
-- Check for working CXX compiler: /usr/bin/g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
CMake Error at /Applications/CMake 2.8-12.app/Contents/share/cmake-    2.8/Modules/FindBoost.cmake:1111 (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:40 (find_package)


-- Found OpenSSL: /usr/lib/libssl.dylib;/usr/lib/libcrypto.dylib (found version "0.9.8y") 
-- Looking for include file pthread.h
-- Looking for include file pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - found
-- Found Threads: TRUE  
CMake Error at CMakeLists.txt:107 (export):
  export given target "cppnetlib-client-connections" which is not built by
  this project.


-- Configuring incomplete, errors occurred!
See also "/Users/lime/Downloads/cpp-netlib-build/CMakeFiles/CMakeOutput.log".

我尝试将 BOOST_ROOT 环境变量设置为“path_to_framework/boost.framework/”和“path_to_framework/boost.framework/Versions/A/”我也尝试将 BOOST_INCLUDEDIR 设置为“path_to_framework/boost.framework/Versions/A/Headers /”直接到头目录。

不幸的是,我每次仍然遇到相同的错误......

谁能帮我设置用于 iOS 7 的 cpp-netlib?我的头目前被 C++ 中的所有编译/要求/库/等所淹没。我来自网络编程背景,使用过 PHP、JavaScript、相当多的 MS PowerShell(是的,我知道... =)),以及过去的一点 Java,但 C/C++ 对我来说是新的。 ..请对新手温柔=)

谢谢,西蒙

4

1 回答 1

0

您需要添加-DBOOST_ROOT=/path/to/your/boost到您的cmake调用中。

于 2015-07-17T07:13:03.023 回答