CMake errors when building cpprestsdk

2019-09-14 18:48发布

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

  • boost
  • openssl

But I get the following output:

$ 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?

UPDATE

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

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]

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.

1条回答
聊天终结者
2楼-- · 2019-09-14 19:37

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

cpprest_find_boost.cmake cpprest_find_openssl.cmake

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.

查看更多
登录 后发表回答