生成cpprestsdk时CMake错误

生成cpprestsdk时CMake错误

本文介绍了生成cpprestsdk时CMake错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试构建cpprestsdk( https://github.com/Microsoft/cpprestsdk )在MSYS2下.使用 pacman 安装了必需的依赖项:

I'm trying to build cpprestsdk (https://github.com/Microsoft/cpprestsdk) under MSYS2. With pacman I installed the required dependencies:

  • 提升
  • openssl

但是我得到以下输出:

$ cmake -G "MSYS Makefiles" .. -DCMAKE_BUILD_TYPE=Release
-- Setting gcc options
-- Added test library httpclient_test
-- Added test library httplistener_test
-- Added test library json_test
-- Added test library pplx_test
-- Added test library streams_test
-- Added test library uri_test
-- Added test library utils_test
-- Added test library websocketclient_test CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the
CMake files:
C:/cpprestsdk/Release/src/Boost_INCLUDE_DIR
used as include directory in directory
C:/cpprestsdk/Release/src
C:/cpprestsdk/Release/tests/functional/streams/Boost_INCLUDE_DIR
used as include directory in directory
C:/cpprestsdk/Release/tests/functional/streams
C:/cpprestsdk/Release/tests/functional/websockets/Boost_INCLUDE_DIR
used as include directory in directory
C:/cpprestsdk/Release/tests/functional/websockets

-- Configuring incomplete, errors occurred! See also "C:/cpprestsdk/Release/build.release/CMakeFiles/CMakeOutput.log".

我很难理解这些错误的实际含义.我尝试检查日志输出,但是没有发现任何明显的问题……

I have difficulties to understand what those errors actually mean.I tried to inspect the log output but I didn't find anything so obvious...

我还缺少其他一些依赖吗?

Am I missing some other dependencies?

根据@Some程序员的好建议,我修复了 cmake 错误,该错误在 CMakelist.txt 中设置了 Boost_INCLUDE_DIR .

After the good suggestion of @Some programmer dude, I fixed the cmake errors setting the Boost_INCLUDE_DIR in CMakelist.txt.

现在,当我发出 make 命令时,我有了这个:

BUT now I have this one when I issue the make command:

$ make
Scanning dependencies of target cpprest
[  0%] Building CXX object src/CMakeFiles/cpprest.dir/http/client/http_client.cpp.obj
cc1plus.exe: error: /mingw32/include/boost: No such file or directory [-Werror=missing-include-dirs]

它说找不到/mingw32/include/boost ,但实际上存在:

It says it cannot find /mingw32/include/boost but it actually exists:

$ ls /mingw32/include/boost/
accumulators             context                       fusion                  make_unique.hpp                predef                         spirit
algorithm                convert                       generator_iterator.hpp  math                           predef.h                       spirit.hpp
align                    convert.hpp                   geometry                math_fwd.hpp                   preprocessor                   statechart
align.hpp                core                          geometry.hpp            mem_fn.hpp                     preprocessor.hpp               static_assert.hpp
aligned_storage.hpp      coroutine                     get_pointer.hpp         memory_order.hpp               program_options                swap.hpp
any.hpp                  coroutine2                    gil                     metaparse                      program_options.hpp            system
...

我不会公开另一个问题,因为我担心这个问题与上一个问题有关-尚未完全解决.

I don't open another question because I'm afraid the issue is related to the previous one - not completely fixed.

推荐答案

如果要修改OpenSSL或Boost位置,则应修改文件:

If you're looking to modify either the OpenSSL or Boost locations, you should modify the files:

cpprest_find_boost.cmakecpprest_find_openssl.cmake

cpprest_find_boost.cmakecpprest_find_openssl.cmake

您可以看到针对不同平台进行管理的不同方式.我已针对iOS进行了修改,以使用静态库而不是它们使用的框架解决方案.

You can see the different ways it is managed for different platforms. I've modified for iOS to use static libs versus the framework solution they are using.

两者都需要为每个各自的库分别声明正确的包含和正确的库路径.

Both require pouting the right includes and right library paths for each respective library.

这篇关于生成cpprestsdk时CMake错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-01 22:38