0

I'm trying to develop a restful client and server in Windows and come up with cpprestsdk. I don´t want to use Visual Studio but I cannot compile successfully any example I find on the web.

Right now I've downloaded https://gitlab.com/eidheim/Simple-Web-Server but when I run cmake -H. -Bbuild I get this error:

"Could NOT find Boost (missing: Boost_INCLUDE_DIR system thread) (Required
  is at least version "1.53.0")"

even though I got boost.

Also tried this: cmake -H. -Bbuild -DBOOST_ROOT="C:\Users\myName\Documents\boost_1_58_0

but I get this error: CMake Error at C:/Program Files/CMake/share/cmake-

3.17/Modules/FindPackageHandleStandardArgs.cmake:164 (message):
  Could NOT find Boost (missing: system thread) (found suitable version
  "1.58.0", minimum required is "1.53.0").

I´ve also tried a simplier example with this CMakeLists:

cmake_minimum_required(VERSION 3.4)
project(main)
set(CMAKE_CXX_STANDARD 11)

target_link_libraries(main PUBLIC cpprestsdk)
find_package(cpprestsdk REQUIRED)

add_executable(main main.cpp)
target_link_libraries(main PRIVATE cpprestsdk)

But also get errors. Can anyone give a hand with these problems, please? Thanks

Svirin
  • 564
  • 1
  • 7
  • 20

1 Answers1

0

Do you have something like find_package(Boost REQUIRED) in your CMakeLists.txt?

You might also try using -DBOOST_LIBRARYDIR in addition to -DBOOST_ROOT.

dwosk
  • 1,202
  • 8
  • 11
  • Thanks for your reply, I've tried what you suggest but I still get the same error message. I'm trying to compile this example: https://gitlab.com/eidheim/Simple-Web-Server/-/tree/master and I cannot find what I'm doing wrong – Florencia Sep 30 '20 at 22:07
  • Might be an issue with your cmake version but just a guess. Try finding a FindBoost.cmake file and placing it in your cmake prefix path. It should handle finding boost and settings those variables for you. – dwosk Sep 30 '20 at 22:18
  • You could also try printing ${Boost_INCLUDE_DIR} to see what directory is actually being searched. – dwosk Sep 30 '20 at 22:23
  • I've found FindBoost.cmake inside the CMake directory. I´ve added set(BOOST_DEBUG ON) before find_package on the CMakeLists of the project, so it lists all the search. I've also reinstalled boost through vcpkg (following this thread: https://stackoverflow.com/questions/61989414/cmake-could-not-find-boost-missing-serialization-found-version-1-73-0) with no luck. The error is the following: Could NOT find Boost (missing: Boost_INCLUDE_DIR system thread) (Required is at least version "1.53.0") I'm new with both Cmake and cpprest and I find it difficult to understand what's going on. – Florencia Oct 01 '20 at 18:17
  • Good find - I'm assuming the directories it's listing matches what you have? You could try looking at https://stackoverflow.com/questions/54378962/could-not-find-the-following-boost-libraries-boost-system. It mentions fixing this issue by moving some of the files in boost around. Keep at it :) – dwosk Oct 01 '20 at 18:43